diff --git a/ConsoleInterface/ConsoleInterface.csproj b/ConsoleInterface/ConsoleInterface.csproj index ac39ed4..1fb20a4 100644 --- a/ConsoleInterface/ConsoleInterface.csproj +++ b/ConsoleInterface/ConsoleInterface.csproj @@ -11,10 +11,10 @@ - - - - + + + + diff --git a/ImageCore.Tests/ImageCore.Tests.csproj b/ImageCore.Tests/ImageCore.Tests.csproj new file mode 100644 index 0000000..4199998 --- /dev/null +++ b/ImageCore.Tests/ImageCore.Tests.csproj @@ -0,0 +1,26 @@ + + + + net5.0 + + false + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + + diff --git a/ImageCore.Tests/TestLocalSystemFilesRetriever.cs b/ImageCore.Tests/TestLocalSystemFilesRetriever.cs new file mode 100644 index 0000000..bff9758 --- /dev/null +++ b/ImageCore.Tests/TestLocalSystemFilesRetriever.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using Image; +using Xunit; + +namespace ImageCore.Tests +{ + public class TestLocalSystemFilesRetriever + { + private readonly string _testsProjectDirectory; + + public TestLocalSystemFilesRetriever() + { + _testsProjectDirectory = Environment.GetEnvironmentVariable("IMAGE_CORE_TESTS"); + } + + [Fact] + public void TestGetFilenamesFromPath_DirectoryNotFound() + { + var filesRetriever = LocalSystemFilesRetriever.Create(); + Assert.Throws(() => filesRetriever.GetFilenamesFromPath("a")); + } + + [Fact] + public void TestGetFilenamesFromPath() + { + var filesRetriever = LocalSystemFilesRetriever.Create(); + var filePaths = filesRetriever.GetFilenamesFromPath(Path.Join(_testsProjectDirectory, "test_pictures")); + Assert.NotNull(filePaths); + var filePathsList = filePaths.ToList(); + var expectedFileNames = new List + { + "IMG_0138.HEIC", "IMG_0140.HEIC", + }; + + Assert.NotEmpty(filePathsList); + for (var i = 0; i < filePathsList.Count; i++) + { + Assert.Equal(expectedFileNames[i], Path.GetFileName(filePathsList[i])); + } + } + } +} \ No newline at end of file diff --git a/ImageCore.Tests/test_pictures/IMG_0138.HEIC b/ImageCore.Tests/test_pictures/IMG_0138.HEIC new file mode 100644 index 0000000..de6943f Binary files /dev/null and b/ImageCore.Tests/test_pictures/IMG_0138.HEIC differ diff --git a/ImageCore.Tests/test_pictures/IMG_0140.HEIC b/ImageCore.Tests/test_pictures/IMG_0140.HEIC new file mode 100644 index 0000000..7f725c3 Binary files /dev/null and b/ImageCore.Tests/test_pictures/IMG_0140.HEIC differ diff --git a/ImageCore/ImageCore.csproj b/ImageCore/ImageCore.csproj index d86fa68..8ba35df 100644 --- a/ImageCore/ImageCore.csproj +++ b/ImageCore/ImageCore.csproj @@ -6,9 +6,9 @@ - - - + + + diff --git a/ImageCore/LosslessCompressor.cs b/ImageCore/LosslessCompressor.cs index 52e17e9..11e26af 100644 --- a/ImageCore/LosslessCompressor.cs +++ b/ImageCore/LosslessCompressor.cs @@ -7,7 +7,7 @@ namespace Image /// public class LosslessCompressor : ICompressor { - public static readonly LosslessCompressor Instance = new LosslessCompressor(); + public static readonly LosslessCompressor Instance = new(); private readonly ImageOptimizer _imageOptimizer; public LosslessCompressor() diff --git a/ImageCore/NullCompressor.cs b/ImageCore/NullCompressor.cs index 9435cd2..2db8169 100644 --- a/ImageCore/NullCompressor.cs +++ b/ImageCore/NullCompressor.cs @@ -5,7 +5,7 @@ /// public class NullCompressor : ICompressor { - public static readonly NullCompressor Instance = new NullCompressor(); + public static readonly NullCompressor Instance = new(); /// /// diff --git a/ImgMetadataRemover.sln.DotSettings.user b/ImgMetadataRemover.sln.DotSettings.user index e0977c7..2a32d30 100644 --- a/ImgMetadataRemover.sln.DotSettings.user +++ b/ImgMetadataRemover.sln.DotSettings.user @@ -2,4 +2,9 @@ <AssemblyExplorer> <Assembly Path="C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\3.1.0\ref\netcoreapp3.1\System.Net.Mail.dll" /> <Assembly Path="C:\Users\nutiu\.nuget\packages\magick.net.core\8.6.1\lib\netstandard21\Magick.NET.Core.dll" /> -</AssemblyExplorer> \ No newline at end of file +</AssemblyExplorer> + <SessionState ContinuousTestingMode="0" IsActive="True" Name="TestGetFilenamesFromPath" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"> + <TestAncestor> + <TestId>xUnit::8EB81515-E62C-4408-84E0-6C27E0293902::net5.0::ImageCore.Tests.TestLocalSystemFilesRetriever.TestGetFilenamesFromPath</TestId> + </TestAncestor> +</SessionState> \ No newline at end of file diff --git a/README.md b/README.md index 4f75269..4899f81 100644 Binary files a/README.md and b/README.md differ