Browse Source

Naming is hard

Piotr Czajkowski 1 month ago
parent
commit
775305a4c7

+ 1 - 1
ProcessFiles/Interfaces/IDirectory.cs

@@ -1,6 +1,6 @@
 using System.IO;
 
-namespace FileOperations.Interfaces
+namespace ProcessFiles.Interfaces
 {
     public interface IDirectory
     {

+ 1 - 1
ProcessFiles/Interfaces/IFile.cs

@@ -1,6 +1,6 @@
 using System.IO;
 
-namespace FileOperations.Interfaces
+namespace ProcessFiles.Interfaces
 {
     public interface IFile
     {

+ 1 - 1
ProcessFiles/Interfaces/IFileSystem.cs

@@ -1,4 +1,4 @@
-namespace FileOperations.Interfaces
+namespace ProcessFiles.Interfaces
 {
     public interface IFileSystem
     {

+ 1 - 1
ProcessFiles/Interfaces/IPath.cs

@@ -1,4 +1,4 @@
-namespace FileOperations.Interfaces
+namespace ProcessFiles.Interfaces
 {
     public interface IPath
     {

+ 2 - 2
ProcessFiles/Models/DefaultDirectory.cs

@@ -1,7 +1,7 @@
 using System.IO;
-using FileOperations.Interfaces;
+using ProcessFiles.Interfaces;
 
-namespace FileOperations.Models
+namespace ProcessFiles.Models
 {
     public class DefaultDirectory : IDirectory
     {

+ 2 - 2
ProcessFiles/Models/DefaultFile.cs

@@ -1,7 +1,7 @@
 using System.IO;
-using FileOperations.Interfaces;
+using ProcessFiles.Interfaces;
 
-namespace FileOperations.Models
+namespace ProcessFiles.Models
 {
     public class DefaultFile : IFile
     {

+ 2 - 2
ProcessFiles/Models/DefaultFileSystem.cs

@@ -1,6 +1,6 @@
-using FileOperations.Interfaces;
+using ProcessFiles.Interfaces;
 
-namespace FileOperations.Models
+namespace ProcessFiles.Models
 {
     public class DefaultFileSystem : IFileSystem
     {

+ 2 - 2
ProcessFiles/Models/DefaultPath.cs

@@ -1,7 +1,7 @@
 using System.IO;
-using FileOperations.Interfaces;
+using ProcessFiles.Interfaces;
 
-namespace FileOperations.Models
+namespace ProcessFiles.Models
 {
     public class DefaultPath : IPath
     {

+ 1 - 1
ProcessFiles/Models/ResultEnum.cs

@@ -1,4 +1,4 @@
-namespace FileOperations.Models
+namespace ProcessFiles.Models
 {
     public enum Result
     {

+ 4 - 4
ProcessFiles/ProcessFiles.cs

@@ -2,12 +2,12 @@
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
-using FileOperations.Interfaces;
-using FileOperations.Models;
+using ProcessFiles.Interfaces;
+using ProcessFiles.Models;
 
-namespace FileOperations
+namespace ProcessFiles
 {
-    public class ProcessFiles(IFileSystem? fileSystem = null)
+    public class FileProcessing(IFileSystem? fileSystem = null)
     {
         private readonly IFileSystem fileSystem = fileSystem ?? new DefaultFileSystem();
         private List<string> errors = [];

+ 8 - 8
ProcessFilesTests/ProcessFilesTests.cs

@@ -2,7 +2,7 @@
 using System.IO;
 using System.Linq;
 using Xunit;
-using FileOperations;
+using ProcessFiles;
 
 namespace ProcessFilesTests
 {
@@ -40,7 +40,7 @@ namespace ProcessFilesTests
                 result = Path.GetFileName(value);
             }
 
-            var test = new ProcessFiles();
+            var test = new FileProcessing();
             var errors = test.Process([TestFolder], "txt", TestAction);
             Assert.Empty(errors);
             Assert.Equal(ExpectedInFolder, result);
@@ -60,7 +60,7 @@ namespace ProcessFilesTests
                 result.Add(Path.GetFileName(value));
             }
 
-            var test = new ProcessFiles();
+            var test = new FileProcessing();
             var errors = test.Process([TestFolder], "txt", TestAction, true);
             Assert.Empty(errors);
             Assert.True(CheckResult(result, expectedInSubFolder));
@@ -75,7 +75,7 @@ namespace ProcessFilesTests
                 result.Add(Path.GetFileName(value));
             }
 
-            var test = new ProcessFiles();
+            var test = new FileProcessing();
             var errors = test.Process(["./testFiles/subFolder", TestFile], "txt", TestAction);
             Assert.Empty(errors);
             Assert.True(CheckResult(result, expectedInSubFolder));
@@ -90,7 +90,7 @@ namespace ProcessFilesTests
                 result = Path.GetFileName(value);
             }
 
-            var test = new ProcessFiles();
+            var test = new FileProcessing();
             var errors = test.Process([TestFile], "txt", TestAction);
             Assert.Empty(errors);
             Assert.Equal(ExpectedInFolder, result);
@@ -105,7 +105,7 @@ namespace ProcessFilesTests
                 result = value;
             }
 
-            var test = new ProcessFiles();
+            var test = new FileProcessing();
             var errors = test.Process(["./testFiles/test.txt"], "txt", TestAction);
             Assert.NotEmpty(errors);
             Assert.Empty(result);
@@ -120,7 +120,7 @@ namespace ProcessFilesTests
                 result = value;
             }
 
-            var test = new ProcessFiles();
+            var test = new FileProcessing();
             var errors = test.Process([TestFile], "abc", TestAction);
             Assert.NotEmpty(errors);
             Assert.Empty(result);
@@ -135,7 +135,7 @@ namespace ProcessFilesTests
                 result.Add(Path.GetFileName(value));
             }
 
-            var test = new ProcessFiles();
+            var test = new FileProcessing();
             var errors = test.Process([TestFolder], ["txt", "json"], TestAction, true);
             Assert.Empty(errors);
             Assert.True(CheckResult(result, expectedInSubFolderMultipleExtensions));

+ 6 - 6
ProcessFilesTests/ProcessFiles_UnitTests.cs

@@ -1,6 +1,6 @@
 using NSubstitute;
-using FileOperations;
-using FileOperations.Interfaces;
+using ProcessFiles;
+using ProcessFiles.Interfaces;
 using Xunit;
 
 namespace ProcessFilesTests
@@ -19,7 +19,7 @@ namespace ProcessFilesTests
             var fakeFileSystem = Substitute.For<IFileSystem>();
             fakeFileSystem.File.Exists(Arg.Any<string>()).Returns(false);
 
-            var test = new ProcessFiles(fakeFileSystem);
+            var test = new FileProcessing(fakeFileSystem);
             var errors = test.Process(["./imaginaryFolder/imaginaryTest.txt"], "txt", TestAction);
             Assert.NotEmpty(errors);
             Assert.Empty(result);
@@ -40,7 +40,7 @@ namespace ProcessFilesTests
             fakeFileSystem.File.Exists(Arg.Any<string>()).Returns(true);
             fakeFileSystem.Path.GetExtension(Arg.Any<string>()).Returns(string.Empty);
 
-            var test = new ProcessFiles(fakeFileSystem);
+            var test = new FileProcessing(fakeFileSystem);
             var errors = test.Process(["imaginaryNoExtension"], "abc", TestAction);
             Assert.NotEmpty(errors);
             Assert.Empty(result);
@@ -62,7 +62,7 @@ namespace ProcessFilesTests
             fakeFileSystem.File.Exists(Arg.Any<string>()).Returns(true);
             fakeFileSystem.Path.GetExtension(Arg.Any<string>()).Returns("def");
 
-            var test = new ProcessFiles(fakeFileSystem);
+            var test = new FileProcessing(fakeFileSystem);
             var errors = test.Process(["imaginaryFile"], "abc", TestAction);
             Assert.NotEmpty(errors);
             Assert.Empty(result);
@@ -85,7 +85,7 @@ namespace ProcessFilesTests
             fakeFileSystem.Path.GetExtension(Arg.Any<string>()).Returns("txt");
 
             const string expectedValue = "imaginary.txt";
-            var test = new ProcessFiles(fakeFileSystem);
+            var test = new FileProcessing(fakeFileSystem);
             var errors = test.Process([expectedValue], "txt", TestAction);
             Assert.Empty(errors);
             Assert.Equal(expectedValue, result);