Skip to content

Commit

Permalink
update test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
coenm committed Sep 25, 2024
1 parent 19415db commit 02c0fa1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
20 changes: 20 additions & 0 deletions tests/RepoM.App.Tests/ConfigBasedAppDataPathProviderFactoryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ public ConfigBasedAppDataPathProviderFactoryTest()
SetupGetFullPath();
}

[Fact]
public void Ctor_ShouldThrow_WhenArgumentNull()
{
// arrange

// act
Func<ConfigBasedAppDataPathProviderFactory> act1 = () => new ConfigBasedAppDataPathProviderFactory([], null!);
Func<ConfigBasedAppDataPathProviderFactory> act2 = () => new ConfigBasedAppDataPathProviderFactory(null!, A.Dummy<IFileSystem>());
Func<ConfigBasedAppDataPathProviderFactory> act3 = () => new ConfigBasedAppDataPathProviderFactory([], A.Dummy<IFileSystem>(), null!);
Func<ConfigBasedAppDataPathProviderFactory> act4 = () => new ConfigBasedAppDataPathProviderFactory([], null!, A.Dummy<IFileProvider>());
Func<ConfigBasedAppDataPathProviderFactory> act5 = () => new ConfigBasedAppDataPathProviderFactory(null!, A.Dummy<IFileSystem>(), A.Dummy<IFileProvider>());

// assert
act1.Should().Throw<ArgumentNullException>();
act2.Should().Throw<ArgumentNullException>();
act3.Should().Throw<ArgumentNullException>();
act4.Should().Throw<ArgumentNullException>();
act5.Should().Throw<ArgumentNullException>();
}

[Fact]
public void Create_ShouldSetPathToRelativeFolder_WhenAppSettingsJsonIsSet()
{
Expand Down

0 comments on commit 02c0fa1

Please sign in to comment.