From fae2e4971de9cd4e1580abcbe6f9d88c02f43379 Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sat, 14 Jan 2023 17:55:14 +0100 Subject: [PATCH 1/4] WIP --- RepoM.sln | 23 +++++++++ .../IO/GitRepositoryFinderFactory.cs | 1 + .../IO/GravellGitRepositoryFinder.cs | 1 + .../IO/GravellGitRepositoryFinderFactory.cs | 1 + .../IO/IGitRepositoryFinderFactory.cs | 2 + src/RepoM.Api/IO/WindowsPathSkipper.cs | 1 + src/RepoM.App/App.xaml.cs | 1 + .../RepositoryFinder}/IGitRepositoryFinder.cs | 2 +- .../RepositoryFinder}/IPathSkipper.cs | 2 +- .../ISingleGitRepositoryFinderFactory.cs | 2 +- .../EverythingGitRepositoryFinderFactory.cs | 2 +- ...erythingModule.cs => EverythingPackage.cs} | 4 +- .../Internal/EverythingGitRepositoryFinder.cs | 2 +- .../RepoM.Plugin.EverythingFileSearch.csproj | 8 ++-- ...erythingGitRepositoryFinderFactoryTests.cs | 20 ++++++++ .../EverythingPackageTests.cs | 47 +++++++++++++++++++ ...M.Plugin.EverythingFileSearch.Tests.csproj | 36 ++++++++++++++ .../TestFramework/VerifierInitializer.cs | 15 ++++++ tests/Specs/DefaultRepositoryMonitorTests.cs | 1 + tests/Specs/Mocks/NeverSkippingPathSkipper.cs | 1 + 20 files changed, 161 insertions(+), 11 deletions(-) rename src/{RepoM.Api/IO => RepoM.Core.Plugin/RepositoryFinder}/IGitRepositoryFinder.cs (77%) rename src/{RepoM.Api/IO => RepoM.Core.Plugin/RepositoryFinder}/IPathSkipper.cs (59%) rename src/{RepoM.Api/IO => RepoM.Core.Plugin/RepositoryFinder}/ISingleGitRepositoryFinderFactory.cs (75%) rename src/RepoM.Plugin.EverythingFileSearch/{EverythingModule.cs => EverythingPackage.cs} (80%) create mode 100644 tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingGitRepositoryFinderFactoryTests.cs create mode 100644 tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingPackageTests.cs create mode 100644 tests/RepoM.Plugin.EverythingFileSearch.Tests/RepoM.Plugin.EverythingFileSearch.Tests.csproj create mode 100644 tests/RepoM.Plugin.EverythingFileSearch.Tests/TestFramework/VerifierInitializer.cs diff --git a/RepoM.sln b/RepoM.sln index 3652c36e..6adf8a62 100644 --- a/RepoM.sln +++ b/RepoM.sln @@ -45,6 +45,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RepoM.Plugin.Clipboard", "s EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RepoM.Plugin.Clipboard.Tests", "tests\RepoM.Plugin.Clipboard.Tests\RepoM.Plugin.Clipboard.Tests.csproj", "{A26EF3E9-C267-499C-B5AB-E4FB3C7AB6E1}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RepoM.Plugin.EverythingFileSearch.Tests", "tests\RepoM.Plugin.EverythingFileSearch.Tests\RepoM.Plugin.EverythingFileSearch.Tests.csproj", "{89D96078-2951-44C2-B5B1-1DA0D5E94C0C}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -459,6 +461,26 @@ Global {A26EF3E9-C267-499C-B5AB-E4FB3C7AB6E1}.Release|x64.Build.0 = Release|Any CPU {A26EF3E9-C267-499C-B5AB-E4FB3C7AB6E1}.Release|x86.ActiveCfg = Release|Any CPU {A26EF3E9-C267-499C-B5AB-E4FB3C7AB6E1}.Release|x86.Build.0 = Release|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Debug|ARM.ActiveCfg = Debug|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Debug|ARM.Build.0 = Debug|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Debug|ARM64.Build.0 = Debug|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Debug|x64.ActiveCfg = Debug|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Debug|x64.Build.0 = Debug|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Debug|x86.ActiveCfg = Debug|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Debug|x86.Build.0 = Debug|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Release|Any CPU.Build.0 = Release|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Release|ARM.ActiveCfg = Release|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Release|ARM.Build.0 = Release|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Release|ARM64.ActiveCfg = Release|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Release|ARM64.Build.0 = Release|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Release|x64.ActiveCfg = Release|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Release|x64.Build.0 = Release|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Release|x86.ActiveCfg = Release|Any CPU + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -478,6 +500,7 @@ Global {1F18CE9A-8E4A-43AB-8E17-34F7564E2198} = {D6E372DC-10D3-4997-9DFC-568B4666635A} {8F87B73D-8A5D-4335-96E9-97EE0495B671} = {D6E372DC-10D3-4997-9DFC-568B4666635A} {A26EF3E9-C267-499C-B5AB-E4FB3C7AB6E1} = {D6E372DC-10D3-4997-9DFC-568B4666635A} + {89D96078-2951-44C2-B5B1-1DA0D5E94C0C} = {D6E372DC-10D3-4997-9DFC-568B4666635A} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {1765ABAA-0652-4DA5-ABBF-05396F2957D7} diff --git a/src/RepoM.Api/IO/GitRepositoryFinderFactory.cs b/src/RepoM.Api/IO/GitRepositoryFinderFactory.cs index f662896e..9ca39ad0 100644 --- a/src/RepoM.Api/IO/GitRepositoryFinderFactory.cs +++ b/src/RepoM.Api/IO/GitRepositoryFinderFactory.cs @@ -4,6 +4,7 @@ namespace RepoM.Api.IO; using System.Collections.Generic; using System.Linq; using RepoM.Api.Common; +using RepoM.Core.Plugin.RepositoryFinder; public class GitRepositoryFinderFactory : IGitRepositoryFinderFactory { diff --git a/src/RepoM.Api/IO/GravellGitRepositoryFinder.cs b/src/RepoM.Api/IO/GravellGitRepositoryFinder.cs index d1bc93f6..76a742b2 100644 --- a/src/RepoM.Api/IO/GravellGitRepositoryFinder.cs +++ b/src/RepoM.Api/IO/GravellGitRepositoryFinder.cs @@ -4,6 +4,7 @@ namespace RepoM.Api.IO; using System.Collections.Generic; using System.IO.Abstractions; using System.Linq; +using RepoM.Core.Plugin.RepositoryFinder; // http://stackoverflow.com/questions/2106877/is-there-a-faster-way-than-this-to-find-all-the-files-in-a-directory-and-all-sub internal class GravellGitRepositoryFinder : IGitRepositoryFinder diff --git a/src/RepoM.Api/IO/GravellGitRepositoryFinderFactory.cs b/src/RepoM.Api/IO/GravellGitRepositoryFinderFactory.cs index 22b7846d..477acc4e 100644 --- a/src/RepoM.Api/IO/GravellGitRepositoryFinderFactory.cs +++ b/src/RepoM.Api/IO/GravellGitRepositoryFinderFactory.cs @@ -2,6 +2,7 @@ namespace RepoM.Api.IO; using System; using System.IO.Abstractions; +using RepoM.Core.Plugin.RepositoryFinder; public class GravellGitRepositoryFinderFactory : ISingleGitRepositoryFinderFactory { diff --git a/src/RepoM.Api/IO/IGitRepositoryFinderFactory.cs b/src/RepoM.Api/IO/IGitRepositoryFinderFactory.cs index 35ab92d1..a16a3316 100644 --- a/src/RepoM.Api/IO/IGitRepositoryFinderFactory.cs +++ b/src/RepoM.Api/IO/IGitRepositoryFinderFactory.cs @@ -1,5 +1,7 @@ namespace RepoM.Api.IO; +using RepoM.Core.Plugin.RepositoryFinder; + public interface IGitRepositoryFinderFactory { IGitRepositoryFinder Create(); diff --git a/src/RepoM.Api/IO/WindowsPathSkipper.cs b/src/RepoM.Api/IO/WindowsPathSkipper.cs index a0fa01a6..60cd094a 100644 --- a/src/RepoM.Api/IO/WindowsPathSkipper.cs +++ b/src/RepoM.Api/IO/WindowsPathSkipper.cs @@ -3,6 +3,7 @@ namespace RepoM.Api.IO; using System; using System.Collections.Generic; using System.Linq; +using RepoM.Core.Plugin.RepositoryFinder; public class WindowsPathSkipper : IPathSkipper { diff --git a/src/RepoM.App/App.xaml.cs b/src/RepoM.App/App.xaml.cs index 85eb8ce2..b3b22069 100644 --- a/src/RepoM.App/App.xaml.cs +++ b/src/RepoM.App/App.xaml.cs @@ -51,6 +51,7 @@ namespace RepoM.App; using RepoM.App.RepositoryOrdering; using RepoM.Core.Plugin.Common; using RepoM.Core.Plugin.Expressions; +using RepoM.Core.Plugin.RepositoryFinder; /// /// Interaction logic for App.xaml diff --git a/src/RepoM.Api/IO/IGitRepositoryFinder.cs b/src/RepoM.Core.Plugin/RepositoryFinder/IGitRepositoryFinder.cs similarity index 77% rename from src/RepoM.Api/IO/IGitRepositoryFinder.cs rename to src/RepoM.Core.Plugin/RepositoryFinder/IGitRepositoryFinder.cs index 4cd101f8..36d9ecfd 100644 --- a/src/RepoM.Api/IO/IGitRepositoryFinder.cs +++ b/src/RepoM.Core.Plugin/RepositoryFinder/IGitRepositoryFinder.cs @@ -1,4 +1,4 @@ -namespace RepoM.Api.IO; +namespace RepoM.Core.Plugin.RepositoryFinder; using System; using System.Collections.Generic; diff --git a/src/RepoM.Api/IO/IPathSkipper.cs b/src/RepoM.Core.Plugin/RepositoryFinder/IPathSkipper.cs similarity index 59% rename from src/RepoM.Api/IO/IPathSkipper.cs rename to src/RepoM.Core.Plugin/RepositoryFinder/IPathSkipper.cs index 81597594..22b655b4 100644 --- a/src/RepoM.Api/IO/IPathSkipper.cs +++ b/src/RepoM.Core.Plugin/RepositoryFinder/IPathSkipper.cs @@ -1,4 +1,4 @@ -namespace RepoM.Api.IO; +namespace RepoM.Core.Plugin.RepositoryFinder; public interface IPathSkipper { diff --git a/src/RepoM.Api/IO/ISingleGitRepositoryFinderFactory.cs b/src/RepoM.Core.Plugin/RepositoryFinder/ISingleGitRepositoryFinderFactory.cs similarity index 75% rename from src/RepoM.Api/IO/ISingleGitRepositoryFinderFactory.cs rename to src/RepoM.Core.Plugin/RepositoryFinder/ISingleGitRepositoryFinderFactory.cs index 366d8c5f..6213a5a9 100644 --- a/src/RepoM.Api/IO/ISingleGitRepositoryFinderFactory.cs +++ b/src/RepoM.Core.Plugin/RepositoryFinder/ISingleGitRepositoryFinderFactory.cs @@ -1,4 +1,4 @@ -namespace RepoM.Api.IO; +namespace RepoM.Core.Plugin.RepositoryFinder; public interface ISingleGitRepositoryFinderFactory { diff --git a/src/RepoM.Plugin.EverythingFileSearch/EverythingGitRepositoryFinderFactory.cs b/src/RepoM.Plugin.EverythingFileSearch/EverythingGitRepositoryFinderFactory.cs index 1b446c00..a625b20f 100644 --- a/src/RepoM.Plugin.EverythingFileSearch/EverythingGitRepositoryFinderFactory.cs +++ b/src/RepoM.Plugin.EverythingFileSearch/EverythingGitRepositoryFinderFactory.cs @@ -2,7 +2,7 @@ namespace RepoM.Plugin.EverythingFileSearch; using System; using JetBrains.Annotations; -using RepoM.Api.IO; +using RepoM.Core.Plugin.RepositoryFinder; using RepoM.Plugin.EverythingFileSearch.Internal; [UsedImplicitly] diff --git a/src/RepoM.Plugin.EverythingFileSearch/EverythingModule.cs b/src/RepoM.Plugin.EverythingFileSearch/EverythingPackage.cs similarity index 80% rename from src/RepoM.Plugin.EverythingFileSearch/EverythingModule.cs rename to src/RepoM.Plugin.EverythingFileSearch/EverythingPackage.cs index f3c1c6cb..2802ea4d 100644 --- a/src/RepoM.Plugin.EverythingFileSearch/EverythingModule.cs +++ b/src/RepoM.Plugin.EverythingFileSearch/EverythingPackage.cs @@ -1,12 +1,12 @@ namespace RepoM.Plugin.EverythingFileSearch; using JetBrains.Annotations; -using RepoM.Api.IO; +using RepoM.Core.Plugin.RepositoryFinder; using SimpleInjector; using SimpleInjector.Packaging; [UsedImplicitly] -public class EverythingModule : IPackage +public class EverythingPackage : IPackage { public void RegisterServices(Container container) { diff --git a/src/RepoM.Plugin.EverythingFileSearch/Internal/EverythingGitRepositoryFinder.cs b/src/RepoM.Plugin.EverythingFileSearch/Internal/EverythingGitRepositoryFinder.cs index 8144de07..018fb4b4 100644 --- a/src/RepoM.Plugin.EverythingFileSearch/Internal/EverythingGitRepositoryFinder.cs +++ b/src/RepoM.Plugin.EverythingFileSearch/Internal/EverythingGitRepositoryFinder.cs @@ -3,7 +3,7 @@ namespace RepoM.Plugin.EverythingFileSearch.Internal; using System; using System.Collections.Generic; using System.Linq; -using RepoM.Api.IO; +using RepoM.Core.Plugin.RepositoryFinder; internal class EverythingGitRepositoryFinder : IGitRepositoryFinder { diff --git a/src/RepoM.Plugin.EverythingFileSearch/RepoM.Plugin.EverythingFileSearch.csproj b/src/RepoM.Plugin.EverythingFileSearch/RepoM.Plugin.EverythingFileSearch.csproj index 65148b3d..49020ef3 100644 --- a/src/RepoM.Plugin.EverythingFileSearch/RepoM.Plugin.EverythingFileSearch.csproj +++ b/src/RepoM.Plugin.EverythingFileSearch/RepoM.Plugin.EverythingFileSearch.csproj @@ -8,14 +8,14 @@ - - - - Always + + + + diff --git a/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingGitRepositoryFinderFactoryTests.cs b/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingGitRepositoryFinderFactoryTests.cs new file mode 100644 index 00000000..f53fff33 --- /dev/null +++ b/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingGitRepositoryFinderFactoryTests.cs @@ -0,0 +1,20 @@ +namespace RepoM.Plugin.EverythingFileSearch.Tests; + +using System; +using FluentAssertions; +using Xunit; + +public class EverythingGitRepositoryFinderFactoryTests +{ + [Fact] + public void Ctor_ShouldThrow_WhenArgumentIsNull() + { + // arrange + + // act + Action act = () => _ = new EverythingGitRepositoryFinderFactory(null!); + + // assert + act.Should().ThrowExactly(); + } +} \ No newline at end of file diff --git a/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingPackageTests.cs b/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingPackageTests.cs new file mode 100644 index 00000000..9579a45c --- /dev/null +++ b/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingPackageTests.cs @@ -0,0 +1,47 @@ +namespace RepoM.Plugin.EverythingFileSearch.Tests; + +using System; +using FakeItEasy; +using RepoM.Core.Plugin.Expressions; +using RepoM.Core.Plugin.RepositoryFinder; +using RepoM.Plugin.EverythingFileSearch; +using SimpleInjector; +using Xunit; + +public class EverythingPackageTests +{ + [Fact] + public void RegisterServices_ShouldBeSuccessful_WhenExternalDependenciesAreRegistered() + { + // arrange + var container = new Container(); + RegisterExternals(container); + var sut = new EverythingPackage(); + + // act + sut.RegisterServices(container); + + // assert + // implicit, Verify throws when container is not valid. + container.Verify(VerificationOption.VerifyAndDiagnose); + } + + [Fact] + public void RegisterServices_ShouldFail_WhenExternalDependenciesAreNotRegistered() + { + // arrange + var container = new Container(); + var sut = new EverythingPackage(); + + // act + sut.RegisterServices(container); + + // assert + Assert.Throws(() => container.Verify(VerificationOption.VerifyAndDiagnose)); + } + + private static void RegisterExternals(Container container) + { + container.RegisterSingleton(A.Dummy); + } +} \ No newline at end of file diff --git a/tests/RepoM.Plugin.EverythingFileSearch.Tests/RepoM.Plugin.EverythingFileSearch.Tests.csproj b/tests/RepoM.Plugin.EverythingFileSearch.Tests/RepoM.Plugin.EverythingFileSearch.Tests.csproj new file mode 100644 index 00000000..ef8f9048 --- /dev/null +++ b/tests/RepoM.Plugin.EverythingFileSearch.Tests/RepoM.Plugin.EverythingFileSearch.Tests.csproj @@ -0,0 +1,36 @@ + + + + net6.0 + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers; buildtransitive + all + + + + + + + diff --git a/tests/RepoM.Plugin.EverythingFileSearch.Tests/TestFramework/VerifierInitializer.cs b/tests/RepoM.Plugin.EverythingFileSearch.Tests/TestFramework/VerifierInitializer.cs new file mode 100644 index 00000000..3697e609 --- /dev/null +++ b/tests/RepoM.Plugin.EverythingFileSearch.Tests/TestFramework/VerifierInitializer.cs @@ -0,0 +1,15 @@ +namespace RepoM.Plugin.Clipboard.Tests.TestFramework; + +using System.Runtime.CompilerServices; +using Argon; +using VerifyTests; + +public static class VerifierInitializer +{ + [ModuleInitializer] + public static void Initialize() + { + VerifierSettings.DisableRequireUniquePrefix(); + VerifierSettings.AddExtraSettings(serializerSettings => serializerSettings.TypeNameHandling = TypeNameHandling.Auto); + } +} \ No newline at end of file diff --git a/tests/Specs/DefaultRepositoryMonitorTests.cs b/tests/Specs/DefaultRepositoryMonitorTests.cs index f77a2e36..0a36fa57 100644 --- a/tests/Specs/DefaultRepositoryMonitorTests.cs +++ b/tests/Specs/DefaultRepositoryMonitorTests.cs @@ -25,6 +25,7 @@ namespace Specs; using RepoM.Api.IO; using RepoM.Api.IO.ModuleBasedRepositoryActionProvider; using RepoM.Api.IO.VariableProviders; +using RepoM.Core.Plugin.RepositoryFinder; using Specs.IO; using Specs.Mocks; diff --git a/tests/Specs/Mocks/NeverSkippingPathSkipper.cs b/tests/Specs/Mocks/NeverSkippingPathSkipper.cs index a0ad2ae7..20f0306a 100644 --- a/tests/Specs/Mocks/NeverSkippingPathSkipper.cs +++ b/tests/Specs/Mocks/NeverSkippingPathSkipper.cs @@ -1,6 +1,7 @@ namespace Specs.Mocks; using RepoM.Api.IO; +using RepoM.Core.Plugin.RepositoryFinder; internal class NeverSkippingPathSkipper : IPathSkipper { From 4f012407fd4bb04616c3e6d94962ccdcef103a5f Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sat, 14 Jan 2023 18:51:35 +0100 Subject: [PATCH 2/4] add tests --- ...erythingGitRepositoryFinderFactoryTests.cs | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingGitRepositoryFinderFactoryTests.cs b/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingGitRepositoryFinderFactoryTests.cs index f53fff33..ab630263 100644 --- a/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingGitRepositoryFinderFactoryTests.cs +++ b/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingGitRepositoryFinderFactoryTests.cs @@ -1,11 +1,22 @@ namespace RepoM.Plugin.EverythingFileSearch.Tests; using System; +using System.Net.NetworkInformation; +using FakeItEasy; using FluentAssertions; +using RepoM.Core.Plugin.RepositoryFinder; +using RepoM.Plugin.EverythingFileSearch.Internal; using Xunit; public class EverythingGitRepositoryFinderFactoryTests { + private readonly IPathSkipper _pathSkipper; + + public EverythingGitRepositoryFinderFactoryTests() + { + _pathSkipper = A.Fake(); + } + [Fact] public void Ctor_ShouldThrow_WhenArgumentIsNull() { @@ -17,4 +28,43 @@ public void Ctor_ShouldThrow_WhenArgumentIsNull() // assert act.Should().ThrowExactly(); } + + [Fact] + public void Name_ShouldBeEverything() + { + // arrange + var sut = new EverythingGitRepositoryFinderFactory(_pathSkipper); + + // act + var result = sut.Name; + + // assert + result.Should().Be("Everything"); + } + + [Fact] + public void IsActive_ShouldReturnSameValueAsEverythingApi() + { + // arrange + var sut = new EverythingGitRepositoryFinderFactory(_pathSkipper); + + // act + var result = sut.IsActive; + + // assert + result.Should().Be(Everything64Api.IsInstalled()); + } + + [Fact] + public void Create_ShouldReturnSameValueAsEverythingApi() + { + // arrange + var sut = new EverythingGitRepositoryFinderFactory(_pathSkipper); + + // act + IGitRepositoryFinder result = sut.Create(); + + // assert + result.Should().NotBeNull().And.BeOfType(); + } } \ No newline at end of file From 5e05fd3dbe78703fae2413ba7752613a0dbbca8d Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sat, 14 Jan 2023 18:55:13 +0100 Subject: [PATCH 3/4] Cleanup --- .../EverythingGitRepositoryFinderFactoryTests.cs | 1 - .../EverythingPackageTests.cs | 1 - ...RepoM.Plugin.EverythingFileSearch.Tests.csproj | 6 ------ .../TestFramework/VerifierInitializer.cs | 15 --------------- 4 files changed, 23 deletions(-) delete mode 100644 tests/RepoM.Plugin.EverythingFileSearch.Tests/TestFramework/VerifierInitializer.cs diff --git a/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingGitRepositoryFinderFactoryTests.cs b/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingGitRepositoryFinderFactoryTests.cs index ab630263..451b54bc 100644 --- a/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingGitRepositoryFinderFactoryTests.cs +++ b/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingGitRepositoryFinderFactoryTests.cs @@ -1,7 +1,6 @@ namespace RepoM.Plugin.EverythingFileSearch.Tests; using System; -using System.Net.NetworkInformation; using FakeItEasy; using FluentAssertions; using RepoM.Core.Plugin.RepositoryFinder; diff --git a/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingPackageTests.cs b/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingPackageTests.cs index 9579a45c..15140a2e 100644 --- a/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingPackageTests.cs +++ b/tests/RepoM.Plugin.EverythingFileSearch.Tests/EverythingPackageTests.cs @@ -2,7 +2,6 @@ namespace RepoM.Plugin.EverythingFileSearch.Tests; using System; using FakeItEasy; -using RepoM.Core.Plugin.Expressions; using RepoM.Core.Plugin.RepositoryFinder; using RepoM.Plugin.EverythingFileSearch; using SimpleInjector; diff --git a/tests/RepoM.Plugin.EverythingFileSearch.Tests/RepoM.Plugin.EverythingFileSearch.Tests.csproj b/tests/RepoM.Plugin.EverythingFileSearch.Tests/RepoM.Plugin.EverythingFileSearch.Tests.csproj index ef8f9048..b8d86d28 100644 --- a/tests/RepoM.Plugin.EverythingFileSearch.Tests/RepoM.Plugin.EverythingFileSearch.Tests.csproj +++ b/tests/RepoM.Plugin.EverythingFileSearch.Tests/RepoM.Plugin.EverythingFileSearch.Tests.csproj @@ -9,7 +9,6 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - all @@ -17,13 +16,8 @@ - - - - - runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/tests/RepoM.Plugin.EverythingFileSearch.Tests/TestFramework/VerifierInitializer.cs b/tests/RepoM.Plugin.EverythingFileSearch.Tests/TestFramework/VerifierInitializer.cs deleted file mode 100644 index 3697e609..00000000 --- a/tests/RepoM.Plugin.EverythingFileSearch.Tests/TestFramework/VerifierInitializer.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace RepoM.Plugin.Clipboard.Tests.TestFramework; - -using System.Runtime.CompilerServices; -using Argon; -using VerifyTests; - -public static class VerifierInitializer -{ - [ModuleInitializer] - public static void Initialize() - { - VerifierSettings.DisableRequireUniquePrefix(); - VerifierSettings.AddExtraSettings(serializerSettings => serializerSettings.TypeNameHandling = TypeNameHandling.Auto); - } -} \ No newline at end of file From 5b1e4c6eab82ac1c47fda65951ea011c8195ec58 Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Sat, 14 Jan 2023 19:06:21 +0100 Subject: [PATCH 4/4] .. --- .../EverythingGitRepositoryFinderTests.cs | 35 +++++++++++++++++++ ...M.Plugin.EverythingFileSearch.Tests.csproj | 4 +++ 2 files changed, 39 insertions(+) create mode 100644 tests/RepoM.Plugin.EverythingFileSearch.Tests/Internal/EverythingGitRepositoryFinderTests.cs diff --git a/tests/RepoM.Plugin.EverythingFileSearch.Tests/Internal/EverythingGitRepositoryFinderTests.cs b/tests/RepoM.Plugin.EverythingFileSearch.Tests/Internal/EverythingGitRepositoryFinderTests.cs new file mode 100644 index 00000000..e0491ba4 --- /dev/null +++ b/tests/RepoM.Plugin.EverythingFileSearch.Tests/Internal/EverythingGitRepositoryFinderTests.cs @@ -0,0 +1,35 @@ +namespace RepoM.Plugin.EverythingFileSearch.Tests.Internal; + +using System; +using FakeItEasy; +using FluentAssertions; +using RepoM.Core.Plugin.RepositoryFinder; +using RepoM.Plugin.EverythingFileSearch.Internal; +using Xunit; + +public class EverythingGitRepositoryFinderTests +{ + [Fact] + public void Ctor_ShouldThrow_WhenArgumentIsNull() + { + // arrange + + // act + Action act = () => _ = new EverythingGitRepositoryFinder(null!); + + // assert + act.Should().ThrowExactly(); + } + + [Fact] + public void Ctor_ShouldNotThrown_WhenArgumentIsNotNull() + { + // arrange + + // act + Action act = () => _ = new EverythingGitRepositoryFinder(A.Dummy()); + + // assert + act.Should().NotThrow(); + } +} \ No newline at end of file diff --git a/tests/RepoM.Plugin.EverythingFileSearch.Tests/RepoM.Plugin.EverythingFileSearch.Tests.csproj b/tests/RepoM.Plugin.EverythingFileSearch.Tests/RepoM.Plugin.EverythingFileSearch.Tests.csproj index b8d86d28..4fd38c74 100644 --- a/tests/RepoM.Plugin.EverythingFileSearch.Tests/RepoM.Plugin.EverythingFileSearch.Tests.csproj +++ b/tests/RepoM.Plugin.EverythingFileSearch.Tests/RepoM.Plugin.EverythingFileSearch.Tests.csproj @@ -27,4 +27,8 @@ + + + +