Skip to content

Commit

Permalink
Use primary constructor parameters.
Browse files Browse the repository at this point in the history
  • Loading branch information
pengweiqhca committed Jun 16, 2024
1 parent d55ca64 commit 359d555
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

public class HostApplicationBuilderTest(IConfiguration configuration, IServiceProvider serviceProvider)
{
private readonly IConfiguration _configuration = configuration;
private readonly IServiceProvider _serviceProvider = serviceProvider;

[Fact]
public void ConfigurationTest() => Assert.Equal("World", _configuration["Hello"]);
public void ConfigurationTest() => Assert.Equal("World", configuration["Hello"]);

[Fact]
public void ServiceTest()
{
var idGenerator = _serviceProvider.GetService<IIdGenerator>();
var idGenerator = serviceProvider.GetService<IIdGenerator>();
Assert.NotNull(idGenerator);
Assert.True(idGenerator is GuidIdGenerator);
}
Expand Down

0 comments on commit 359d555

Please sign in to comment.