소스 검색

More tests

Piotr Czajkowski 2 달 전
부모
커밋
7d26f74ca3
1개의 변경된 파일23개의 추가작업 그리고 1개의 파일을 삭제
  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>());
+        }
     }
 }