瀏覽代碼

Added ProcessErrorsDontAccumulate

Piotr Czajkowski 8 小時之前
父節點
當前提交
cd7b91a70d
共有 1 個文件被更改,包括 17 次插入 和 0 次删除
  1. 17 0
      ProcessFilesTests/ProcessFilesTests.cs

+ 17 - 0
ProcessFilesTests/ProcessFilesTests.cs

@@ -188,5 +188,22 @@ namespace ProcessFilesTests
                 Assert.Throws<ArgumentException>(() => test.Process([testFolder], $"test{character}test", Console.WriteLine));
             }
         }
+        
+        [Fact]
+        public void ProcessErrorsDontAccumulate()
+        {
+            var result = string.Empty;
+            void TestAction(string value)
+            {
+                result = value;
+            }
+
+            var test = new ProcessFiles.ProcessFiles();
+            var errors1 = test.Process(["./testFiles/test.txt"], "txt", TestAction);
+            var errors2 = test.Process(["./nonExistent"], "txt", TestAction);
+            Assert.NotEmpty(errors1);
+            Assert.NotEmpty(errors2);
+            Assert.DoesNotContain(errors1, x => errors2.Contains(x));
+        }
     }
 }