Browse Source

Added ProcessErrorsDontAccumulate

Piotr Czajkowski 8 hours ago
parent
commit
cd7b91a70d
1 changed files with 17 additions and 0 deletions
  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));
+        }
     }
 }