Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions GraphHealthChecks.Tests/GraphHealthChecks.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="HotChocolate.AspNetCore" Version="16.0.9"/>
<PackageReference Include="HotChocolate.AspNetCore.Authorization" Version="16.0.9"/>
<PackageReference Include="HotChocolate.AspNetCore" Version="16.6.0"/>
<PackageReference Include="HotChocolate.AspNetCore.Authorization" Version="16.6.0"/>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.8.1"/>
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="10.0.10"/>
<PackageReference Include="NSubstitute" Version="6.0.0"/>
Expand Down
94 changes: 94 additions & 0 deletions GraphHealthChecks.Tests/GraphHealthChecksFactoriesTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,100 @@ public void GraphHealthCheckFactoryWithLoggerFnDefaultSchema()
Assert.Null((result as GraphHealthCheck)?.Schema);
}

[Fact(DisplayName = "GraphHealthChecksFactories - GraphHealthCheckFactoryUsingProviderWithNoLogger - Custom Schema")]
public void GraphHealthCheckFactoryUsingProviderWithNoLoggerCustomSchema()
{
var result = GraphHealthChecksFactories.GraphHealthCheckFactoryUsingProviderWithNoLogger("schema")(
new ServiceCollection()
.AddGraphQLServer()
.AddQueryType<Query>()
.Services
.BuildServiceProvider()
);

Assert.IsType<GraphHealthCheck>(result, exactMatch: false);
Assert.Equal("schema", (result as GraphHealthCheck)?.Schema);
}

[Fact(DisplayName = "GraphHealthChecksFactories - GraphHealthCheckFactoryUsingProviderWithNoLogger - Default Schema")]
public void GraphHealthCheckFactoryUsingProviderWithNoLoggerDefaultSchema()
{
var result = GraphHealthChecksFactories.GraphHealthCheckFactoryUsingProviderWithNoLogger()(
new ServiceCollection()
.AddGraphQLServer()
.AddQueryType<Query>()
.Services
.BuildServiceProvider()
);

Assert.IsType<GraphHealthCheck>(result, exactMatch: false);
Assert.Null((result as GraphHealthCheck)?.Schema);
}

[Fact(DisplayName = "GraphHealthChecksFactories - GraphHealthCheckFactoryUsingProviderWithILogger - Custom Schema")]
public void GraphHealthCheckFactoryUsingProviderWithILoggerCustomSchema()
{
var result = GraphHealthChecksFactories.GraphHealthCheckFactoryUsingProviderWithILogger("schema")(
new ServiceCollection()
.AddLogging()
.AddGraphQLServer()
.AddQueryType<Query>()
.Services
.BuildServiceProvider()
);

Assert.IsType<GraphHealthCheck>(result, exactMatch: false);
Assert.Equal("schema", (result as GraphHealthCheck)?.Schema);
}

[Fact(DisplayName = "GraphHealthChecksFactories - GraphHealthCheckFactoryUsingProviderWithILogger - Default Schema")]
public void GraphHealthCheckFactoryUsingProviderWithILoggerDefaultSchema()
{
var result = GraphHealthChecksFactories.GraphHealthCheckFactoryUsingProviderWithILogger()(
new ServiceCollection()
.AddLogging()
.AddGraphQLServer()
.AddQueryType<Query>()
.Services
.BuildServiceProvider()
);

Assert.IsType<GraphHealthCheck>(result, exactMatch: false);
Assert.Null((result as GraphHealthCheck)?.Schema);
}

[Fact(DisplayName = "GraphHealthChecksFactories - GraphHealthCheckFactoryUsingProviderWithLoggerFn - Custom Schema")]
public void GraphHealthCheckFactoryUsingProviderWithLoggerFnCustomSchema()
{
var result = GraphHealthChecksFactories.GraphHealthCheckFactoryUsingProviderWithILoggerFactory("schema")(
new ServiceCollection()
.AddLogging()
.AddGraphQLServer()
.AddQueryType<Query>()
.Services
.BuildServiceProvider()
);

Assert.IsType<GraphHealthCheck>(result, exactMatch: false);
Assert.Equal("schema", (result as GraphHealthCheck)?.Schema);
}

[Fact(DisplayName = "GraphHealthChecksFactories - GraphHealthCheckFactoryUsingProviderWithLoggerFn - Default Schema")]
public void GraphHealthCheckFactoryUsingProviderWithLoggerFnDefaultSchema()
{
var result = GraphHealthChecksFactories.GraphHealthCheckFactoryUsingProviderWithILoggerFactory()(
new ServiceCollection()
.AddLogging()
.AddGraphQLServer()
.AddQueryType<Query>()
.Services
.BuildServiceProvider()
);

Assert.IsType<GraphHealthCheck>(result, exactMatch: false);
Assert.Null((result as GraphHealthCheck)?.Schema);
}

public class Query
{
public string Name => "Hello";
Expand Down
Loading
Loading