From 4e0c6e1031fff410c3c2d887da83bfcc204b39a9 Mon Sep 17 00:00:00 2001 From: Mehrshad Date: Tue, 22 Aug 2023 12:47:11 +0330 Subject: [PATCH] FileConventions: add failing test Add tests for NotFollowingConsoleAppConvention function and we fix ConsoleAppConvention2 test so that project name does not contradict new tests. --- ...onsoleProjectWithRightName.Console.fsproj} | 0 .../Program.fs | 0 .../DummyConsoleProjectWithWrongName.fsproj | 12 +++++++ .../Program.fs | 1 + .../DummyProjectWithRight.Console.fsproj | 12 +++++++ .../DummyProjectWithRight.Console/Program.fs | 1 + .../FileConventions.Test.fs | 32 +++++++++++++++++-- .../FileConventions.Test.fsproj | 6 +++- 8 files changed, 61 insertions(+), 3 deletions(-) rename src/FileConventions.Test/DummyFiles/{DummyProjectWithRightConsole/DummyProjectWithRightConsole.fsproj => DummyConsoleProjectWithRightName.Console/DummyConsoleProjectWithRightName.Console.fsproj} (100%) rename src/FileConventions.Test/DummyFiles/{DummyProjectWithRightConsole => DummyConsoleProjectWithRightName.Console}/Program.fs (100%) create mode 100644 src/FileConventions.Test/DummyFiles/DummyConsoleProjectWithWrongName/DummyConsoleProjectWithWrongName.fsproj create mode 100644 src/FileConventions.Test/DummyFiles/DummyConsoleProjectWithWrongName/Program.fs create mode 100644 src/FileConventions.Test/DummyFiles/DummyProjectWithRight.Console/DummyProjectWithRight.Console.fsproj create mode 100644 src/FileConventions.Test/DummyFiles/DummyProjectWithRight.Console/Program.fs diff --git a/src/FileConventions.Test/DummyFiles/DummyProjectWithRightConsole/DummyProjectWithRightConsole.fsproj b/src/FileConventions.Test/DummyFiles/DummyConsoleProjectWithRightName.Console/DummyConsoleProjectWithRightName.Console.fsproj similarity index 100% rename from src/FileConventions.Test/DummyFiles/DummyProjectWithRightConsole/DummyProjectWithRightConsole.fsproj rename to src/FileConventions.Test/DummyFiles/DummyConsoleProjectWithRightName.Console/DummyConsoleProjectWithRightName.Console.fsproj diff --git a/src/FileConventions.Test/DummyFiles/DummyProjectWithRightConsole/Program.fs b/src/FileConventions.Test/DummyFiles/DummyConsoleProjectWithRightName.Console/Program.fs similarity index 100% rename from src/FileConventions.Test/DummyFiles/DummyProjectWithRightConsole/Program.fs rename to src/FileConventions.Test/DummyFiles/DummyConsoleProjectWithRightName.Console/Program.fs diff --git a/src/FileConventions.Test/DummyFiles/DummyConsoleProjectWithWrongName/DummyConsoleProjectWithWrongName.fsproj b/src/FileConventions.Test/DummyFiles/DummyConsoleProjectWithWrongName/DummyConsoleProjectWithWrongName.fsproj new file mode 100644 index 00000000..299cf40e --- /dev/null +++ b/src/FileConventions.Test/DummyFiles/DummyConsoleProjectWithWrongName/DummyConsoleProjectWithWrongName.fsproj @@ -0,0 +1,12 @@ + + + + Exe + net7.0 + + + + + + + diff --git a/src/FileConventions.Test/DummyFiles/DummyConsoleProjectWithWrongName/Program.fs b/src/FileConventions.Test/DummyFiles/DummyConsoleProjectWithWrongName/Program.fs new file mode 100644 index 00000000..543f77ad --- /dev/null +++ b/src/FileConventions.Test/DummyFiles/DummyConsoleProjectWithWrongName/Program.fs @@ -0,0 +1 @@ +printf "Hello World" diff --git a/src/FileConventions.Test/DummyFiles/DummyProjectWithRight.Console/DummyProjectWithRight.Console.fsproj b/src/FileConventions.Test/DummyFiles/DummyProjectWithRight.Console/DummyProjectWithRight.Console.fsproj new file mode 100644 index 00000000..299cf40e --- /dev/null +++ b/src/FileConventions.Test/DummyFiles/DummyProjectWithRight.Console/DummyProjectWithRight.Console.fsproj @@ -0,0 +1,12 @@ + + + + Exe + net7.0 + + + + + + + diff --git a/src/FileConventions.Test/DummyFiles/DummyProjectWithRight.Console/Program.fs b/src/FileConventions.Test/DummyFiles/DummyProjectWithRight.Console/Program.fs new file mode 100644 index 00000000..543f77ad --- /dev/null +++ b/src/FileConventions.Test/DummyFiles/DummyProjectWithRight.Console/Program.fs @@ -0,0 +1 @@ +printf "Hello World" diff --git a/src/FileConventions.Test/FileConventions.Test.fs b/src/FileConventions.Test/FileConventions.Test.fs index bcbfc5b6..ed02423b 100644 --- a/src/FileConventions.Test/FileConventions.Test.fs +++ b/src/FileConventions.Test/FileConventions.Test.fs @@ -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) + + +[] +let ConsoleAppConvention3() = + let fileInfo = + FileInfo( + Path.Combine( + dummyFilesDirectory.FullName, + "DummyConsoleProjectWithWrongName", + "DummyConsoleProjectWithWrongName.fsproj" + ) + ) + + Assert.That(NotFollowingConsoleAppConvention fileInfo, Is.EqualTo true) + + +[] +let ConsoleAppConvention4() = + let fileInfo = + FileInfo( + Path.Combine( + dummyFilesDirectory.FullName, + "DummyConsoleProjectWithRightName.Console", + "DummyConsoleProjectWithRightName.Console.fsproj" ) ) diff --git a/src/FileConventions.Test/FileConventions.Test.fsproj b/src/FileConventions.Test/FileConventions.Test.fsproj index 00dad950..cb727a5e 100644 --- a/src/FileConventions.Test/FileConventions.Test.fsproj +++ b/src/FileConventions.Test/FileConventions.Test.fsproj @@ -51,6 +51,10 @@ - + + + + +