|
@@ -9,18 +9,15 @@ namespace ProcessFilesTests
|
|
|
private readonly string testFolder = "./testFiles";
|
|
|
private readonly string testFile = "./testFiles/test1.txt";
|
|
|
|
|
|
- private readonly List<string> expectedInSubFolder = new()
|
|
|
- {
|
|
|
+ private readonly List<string> expectedInSubFolder =
|
|
|
+ [
|
|
|
"test2.txt",
|
|
|
"test3.txt"
|
|
|
- };
|
|
|
+ ];
|
|
|
|
|
|
- private readonly List<string> expectedInSubFolderMultipleExtensions = new()
|
|
|
- {
|
|
|
- "test.json"
|
|
|
- };
|
|
|
+ private readonly List<string> expectedInSubFolderMultipleExtensions = ["test.json"];
|
|
|
|
|
|
- private readonly string expectedInFolder = "test1.txt";
|
|
|
+ private const string expectedInFolder = "test1.txt";
|
|
|
|
|
|
public ProcessFilesTests()
|
|
|
{
|
|
@@ -37,7 +34,8 @@ namespace ProcessFilesTests
|
|
|
result = Path.GetFileName(value);
|
|
|
}
|
|
|
|
|
|
- var errors = ProcessFiles.ProcessFiles.Process(new[] { testFolder }, "txt", TestAction);
|
|
|
+ var test = new ProcessFiles.ProcessFiles();
|
|
|
+ var errors = test.Process([testFolder], "txt", TestAction);
|
|
|
Assert.Empty(errors);
|
|
|
Assert.Equal(expectedInFolder, result);
|
|
|
}
|
|
@@ -65,7 +63,8 @@ namespace ProcessFilesTests
|
|
|
result.Add(Path.GetFileName(value));
|
|
|
}
|
|
|
|
|
|
- var errors = ProcessFiles.ProcessFiles.Process(new[] { testFolder }, "txt", TestAction, true);
|
|
|
+ var test = new ProcessFiles.ProcessFiles();
|
|
|
+ var errors = test.Process([testFolder], "txt", TestAction, true);
|
|
|
Assert.Empty(errors);
|
|
|
Assert.True(CheckResult(result, expectedInSubFolder));
|
|
|
}
|
|
@@ -79,7 +78,8 @@ namespace ProcessFilesTests
|
|
|
result.Add(Path.GetFileName(value));
|
|
|
}
|
|
|
|
|
|
- var errors = ProcessFiles.ProcessFiles.Process(new[] { "./testFiles/subFolder", testFile }, "txt", TestAction);
|
|
|
+ var test = new ProcessFiles.ProcessFiles();
|
|
|
+ var errors = test.Process(["./testFiles/subFolder", testFile], "txt", TestAction);
|
|
|
Assert.Empty(errors);
|
|
|
Assert.True(CheckResult(result, expectedInSubFolder));
|
|
|
}
|
|
@@ -93,7 +93,8 @@ namespace ProcessFilesTests
|
|
|
result = Path.GetFileName(value);
|
|
|
}
|
|
|
|
|
|
- var errors = ProcessFiles.ProcessFiles.Process(new[] { testFile }, "txt", TestAction);
|
|
|
+ var test = new ProcessFiles.ProcessFiles();
|
|
|
+ var errors = test.Process([testFile], "txt", TestAction);
|
|
|
Assert.Empty(errors);
|
|
|
Assert.Equal(expectedInFolder, result);
|
|
|
}
|
|
@@ -107,7 +108,8 @@ namespace ProcessFilesTests
|
|
|
result = value;
|
|
|
}
|
|
|
|
|
|
- var errors = ProcessFiles.ProcessFiles.Process(new[] { "./testFiles/test.txt" }, "txt", TestAction);
|
|
|
+ var test = new ProcessFiles.ProcessFiles();
|
|
|
+ var errors = test.Process(["./testFiles/test.txt"], "txt", TestAction);
|
|
|
Assert.NotEmpty(errors);
|
|
|
Assert.Empty(result);
|
|
|
}
|
|
@@ -121,7 +123,8 @@ namespace ProcessFilesTests
|
|
|
result = value;
|
|
|
}
|
|
|
|
|
|
- var errors = ProcessFiles.ProcessFiles.Process(new[] { testFile }, "abc", TestAction);
|
|
|
+ var test = new ProcessFiles.ProcessFiles();
|
|
|
+ var errors = test.Process([testFile], "abc", TestAction);
|
|
|
Assert.NotEmpty(errors);
|
|
|
Assert.Empty(result);
|
|
|
}
|
|
@@ -135,7 +138,8 @@ namespace ProcessFilesTests
|
|
|
result.Add(Path.GetFileName(value));
|
|
|
}
|
|
|
|
|
|
- var errors = ProcessFiles.ProcessFiles.Process(new[] { testFolder }, new[] { "txt", "json" }, TestAction, true);
|
|
|
+ var test = new ProcessFiles.ProcessFiles();
|
|
|
+ var errors = test.Process([testFolder], ["txt", "json"], TestAction, true);
|
|
|
Assert.Empty(errors);
|
|
|
Assert.True(CheckResult(result, expectedInSubFolderMultipleExtensions));
|
|
|
}
|