From 02c0fa1d2eaa59212166d86e8b165800cd4e2b12 Mon Sep 17 00:00:00 2001 From: Coen van den Munckhof Date: Wed, 25 Sep 2024 20:42:03 +0200 Subject: [PATCH] update test coverage --- .../ConfigBasedAppDataPathProviderFactory.cs | 2 +- ...nfigBasedAppDataPathProviderFactoryTest.cs | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/RepoM.App/Services/ConfigBasedAppDataPathProviderFactory.cs b/src/RepoM.App/Services/ConfigBasedAppDataPathProviderFactory.cs index 93f7d17e..cf24e78e 100644 --- a/src/RepoM.App/Services/ConfigBasedAppDataPathProviderFactory.cs +++ b/src/RepoM.App/Services/ConfigBasedAppDataPathProviderFactory.cs @@ -22,7 +22,7 @@ public ConfigBasedAppDataPathProviderFactory(string[] args, IFileSystem fileSyst public ConfigBasedAppDataPathProviderFactory(string[] args, IFileSystem fileSystem, IFileProvider fileProvider) :this(args, fileSystem) { - _fileProvider = fileProvider; + _fileProvider = fileProvider ?? throw new ArgumentNullException(nameof(fileProvider)); } public AppDataPathProvider Create() diff --git a/tests/RepoM.App.Tests/ConfigBasedAppDataPathProviderFactoryTest.cs b/tests/RepoM.App.Tests/ConfigBasedAppDataPathProviderFactoryTest.cs index f929c146..e739ca4b 100644 --- a/tests/RepoM.App.Tests/ConfigBasedAppDataPathProviderFactoryTest.cs +++ b/tests/RepoM.App.Tests/ConfigBasedAppDataPathProviderFactoryTest.cs @@ -41,6 +41,26 @@ public ConfigBasedAppDataPathProviderFactoryTest() SetupGetFullPath(); } + [Fact] + public void Ctor_ShouldThrow_WhenArgumentNull() + { + // arrange + + // act + Func act1 = () => new ConfigBasedAppDataPathProviderFactory([], null!); + Func act2 = () => new ConfigBasedAppDataPathProviderFactory(null!, A.Dummy()); + Func act3 = () => new ConfigBasedAppDataPathProviderFactory([], A.Dummy(), null!); + Func act4 = () => new ConfigBasedAppDataPathProviderFactory([], null!, A.Dummy()); + Func act5 = () => new ConfigBasedAppDataPathProviderFactory(null!, A.Dummy(), A.Dummy()); + + // assert + act1.Should().Throw(); + act2.Should().Throw(); + act3.Should().Throw(); + act4.Should().Throw(); + act5.Should().Throw(); + } + [Fact] public void Create_ShouldSetPathToRelativeFolder_WhenAppSettingsJsonIsSet() {