-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed93de8
commit 1be6807
Showing
1 changed file
with
45 additions
and
45 deletions.
There are no files selected for viewing
90 changes: 45 additions & 45 deletions
90
....Core.Tests/Hackney.Core.Tests.DynamoDb/HealthCheck/DynamoDbHealthCheckExtensionsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,45 @@ | ||
using FluentAssertions; | ||
using Hackney.Core.DynamoDb.HealthCheck; | ||
using Hackney.Core.Testing.Shared; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Diagnostics.HealthChecks; | ||
using Moq; | ||
using Xunit; | ||
|
||
namespace Hackney.Core.Tests.DynamoDb.HealthCheck | ||
{ | ||
public class DynamoDbHealthCheckExtensionsTests | ||
{ | ||
|
||
[Fact] | ||
public void RegisterDynamoDbHealthCheckTest() | ||
{ | ||
var services = new ServiceCollection(); | ||
_ = services.RegisterDynamoDbHealthCheck<TestModelDb>(); | ||
|
||
services.IsServiceRegistered<IHealthCheck, DynamoDbHealthCheck<TestModelDb>>().Should().BeTrue(); | ||
} | ||
|
||
[Fact] | ||
public void ServiceCollectionAddDynamoDbHealthCheckTest() | ||
{ | ||
var services = new ServiceCollection(); | ||
_ = services.AddDynamoDbHealthCheck<TestModelDb>(); | ||
|
||
services.IsServiceRegistered<IHealthCheck, DynamoDbHealthCheck<TestModelDb>>().Should().BeTrue(); | ||
|
||
// We can't explicitly verify the Healthcheck builder reigstration here as it is not accessible. | ||
// We have to reply on the test below to do that for us. | ||
} | ||
|
||
[Fact] | ||
public void HealthChecksBuilderAddDynamoDbHealthCheckTest() | ||
{ | ||
var mockBuilder = new Mock<IHealthChecksBuilder>(); | ||
_ = mockBuilder.Object.AddDynamoDbHealthCheck<TestModelDb>(); | ||
|
||
mockBuilder.Verify(x => x.Add(It.Is<HealthCheckRegistration>(hcr => hcr.Name == "DynamoDb" | ||
&& hcr.Factory != null)), Times.Once); | ||
} | ||
} | ||
} | ||
using FluentAssertions; | ||
using Hackney.Core.DynamoDb.HealthCheck; | ||
using Hackney.Core.Testing.Shared; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Diagnostics.HealthChecks; | ||
using Moq; | ||
using Xunit; | ||
|
||
namespace Hackney.Core.Tests.DynamoDb.HealthCheck | ||
{ | ||
public class DynamoDbHealthCheckExtensionsTests | ||
{ | ||
|
||
[Fact] | ||
public void RegisterDynamoDbHealthCheckTest() | ||
{ | ||
var services = new ServiceCollection(); | ||
_ = services.RegisterDynamoDbHealthCheck<TestModelDb>(); | ||
|
||
services.IsServiceRegistered<IHealthCheck, DynamoDbHealthCheck<TestModelDb>>().Should().BeTrue(); | ||
} | ||
|
||
[Fact] | ||
public void ServiceCollectionAddDynamoDbHealthCheckTest() | ||
{ | ||
var services = new ServiceCollection(); | ||
_ = services.AddDynamoDbHealthCheck<TestModelDb>(); | ||
|
||
services.IsServiceRegistered<IHealthCheck, DynamoDbHealthCheck<TestModelDb>>().Should().BeTrue(); | ||
|
||
// We can't explicitly verify the Healthcheck builder reigstration here as it is not accessible. | ||
// We have to reply on the test below to do that for us. | ||
} | ||
|
||
[Fact] | ||
public void HealthChecksBuilderAddDynamoDbHealthCheckTest() | ||
{ | ||
var mockBuilder = new Mock<IHealthChecksBuilder>(); | ||
_ = mockBuilder.Object.AddDynamoDbHealthCheck<TestModelDb>(); | ||
|
||
mockBuilder.Verify(x => x.Add(It.Is<HealthCheckRegistration>(hcr => hcr.Name == "DynamoDb_" + typeof(TestModelDb).Name | ||
&& hcr.Factory != null)), Times.Once); | ||
} | ||
} | ||
} |