Browse Source

More tests

Piotr Czajkowski 2 months ago
parent
commit
7d26f74ca3
1 changed files with 23 additions and 1 deletions
  1. 23 1
      ProcessFilesTests/ProcessFiles_UnitTests.cs

+ 23 - 1
ProcessFilesTests/ProcessFiles_UnitTests.cs

@@ -28,7 +28,7 @@ namespace ProcessFilesTests
         }
 
         [Fact]
-        public void ProcessFileNotMatchExtensionTest()
+        public void ProcessFileNoExtensionTest()
         {
             var result = string.Empty;
             void TestAction(string value)
@@ -48,5 +48,27 @@ namespace ProcessFilesTests
             fakeFileSystem.File.Received().Exists(Arg.Any<string>());
             fakeFileSystem.Path.Received().GetExtension(Arg.Any<string>());
         }
+
+        [Fact]
+        public void ProcessFileNotMatchExtensionTest()
+        {
+            var result = string.Empty;
+            void TestAction(string value)
+            {
+                result = value;
+            }
+
+            var fakeFileSystem = Substitute.For<IFileSystem>();
+            fakeFileSystem.File.Exists(Arg.Any<string>()).Returns(true);
+            fakeFileSystem.Path.GetExtension(Arg.Any<string>()).Returns("def");
+
+            var test = new ProcessFiles.ProcessFiles(fakeFileSystem);
+            var errors = test.Process(["imaginaryFile"], "abc", TestAction);
+            Assert.NotEmpty(errors);
+            Assert.Empty(result);
+
+            fakeFileSystem.File.Received().Exists(Arg.Any<string>());
+            fakeFileSystem.Path.Received().GetExtension(Arg.Any<string>());
+        }
     }
 }