Skip to content

Commit

Permalink
FileConventions: add failing test
Browse files Browse the repository at this point in the history
Add tests for NotFollowingConsoleAppConvention function
and we fix ConsoleAppConvention2 test so that project
name does not contradict new tests.
  • Loading branch information
Mersho committed Aug 22, 2023
1 parent e9ec0ec commit 65a9c8d
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
printf "Hello World"
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
printf "Hello World"
32 changes: 30 additions & 2 deletions src/FileConventions.Test/FileConventions.Test.fs
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,36 @@ let ConsoleAppConvention2() =
FileInfo(
Path.Combine(
dummyFilesDirectory.FullName,
"DummyProjectWithRightConsole",
"DummyProjectWithRightConsole.fsproj"
"DummyProjectWithRight.Console",
"DummyProjectWithRight.Console.fsproj"
)
)

Assert.That(NotFollowingConsoleAppConvention fileInfo, Is.EqualTo false)


[<Test>]
let ConsoleAppConvention3() =
let fileInfo =
FileInfo(
Path.Combine(
dummyFilesDirectory.FullName,
"DummyConsoleProjectWithWrongName",
"DummyConsoleProjectWithWrongName.fsproj"
)
)

Assert.That(NotFollowingConsoleAppConvention fileInfo, Is.EqualTo true)


[<Test>]
let ConsoleAppConvention4() =
let fileInfo =
FileInfo(
Path.Combine(
dummyFilesDirectory.FullName,
"DummyConsoleProjectWithRightName.Console",
"DummyConsoleProjectWithRightName.Console.fsproj"
)
)

Expand Down
6 changes: 5 additions & 1 deletion src/FileConventions.Test/FileConventions.Test.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
<None Include="DummyFiles\DummyProjectWithRightConsole\Program.fs" />
<Content Include="DummyFiles\DummyProjectWithRightConsole\DummyProjectWithRightConsole.fsproj" />
<None Include="DummyFiles\DummyProjectWithWrongConsole\Library.fs" />
<Content Include="DummyFiles\DummyProjectWithRightConsole\DummyProjectWithwrongConsole.fsproj" />
<Content Include="DummyFiles\DummyProjectWithWrongConsole\DummyProjectWithWrongConsole.fsproj" />
<None Include="DummyFiles\DummyConsoleProjectWithWrongName\Program.fs" />
<Content Include="DummyFiles\DummyConsoleProjectWithWrongName\DummyConsoleProjectWithWrongName.fsproj" />
<None Include="DummyFiles\DummyConsoleProjectWithRightName.Console\Library.fs" />
<Content Include="DummyFiles\DummyConsoleProjectWithRightName.Console\DummyConsoleProjectWithRightName.Console.fsproj" />
</ItemGroup>
</Project>

0 comments on commit 65a9c8d

Please sign in to comment.