Skip to content

Commit

Permalink
FileConventions: add failing test
Browse files Browse the repository at this point in the history
Add tests for NotFollowingNamespaceConvention function.
  • Loading branch information
tehraninasab committed Aug 8, 2023
1 parent 1e3ca60 commit c0048c1
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace Foo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
namespace Baz
30 changes: 30 additions & 0 deletions src/FileConventions.Test/FileConventions.Test.fs
Original file line number Diff line number Diff line change
Expand Up @@ -603,3 +603,33 @@ let ProjFilesNamingConvention2() =
))

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


[<Test>]
let NamespaceConvention1() =
let fileInfo =
(FileInfo(
Path.Combine(
dummyFilesDirectory.FullName,
"src",
"Foo",
"DummyFileUnderFooWithRightNamespace.fs"
)
))

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


[<Test>]
let NamespaceConvention2() =
let fileInfo =
(FileInfo(
Path.Combine(
dummyFilesDirectory.FullName,
"src",
"Foo",
"DummyFileUnderFooWithWrongNamespace.fs"
)
))

Assert.That(NotFollowingNamespaceConvention fileInfo, Is.EqualTo true)
4 changes: 4 additions & 0 deletions src/FileConventions/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -402,3 +402,7 @@ let ProjFilesNamingConvention(fileInfo: FileInfo) =
parentDirectoryName

fileName <> parentDirectoryName

let NotFollowingNamespaceConvention(fileInfo: FileInfo) =
printfn "%s" fileInfo.FullName
false

0 comments on commit c0048c1

Please sign in to comment.