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 authored and Mersho committed Aug 17, 2023
1 parent cc82850 commit a0272d6
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 @@ -640,3 +640,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 @@ -409,3 +409,7 @@ let ProjFilesNamingConvention(fileInfo: FileInfo) =
parentDirectoryName

fileName <> parentDirectoryName

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

0 comments on commit a0272d6

Please sign in to comment.