Reformat/cleanup
All checks were successful
NuGet Package Publish / nuget (push) Successful in 1m10s
All checks were successful
NuGet Package Publish / nuget (push) Successful in 1m10s
This commit is contained in:
@@ -9,7 +9,7 @@ namespace ZB.MOM.WW.CBDDC.Hosting.Tests;
|
||||
public class CBDDCHealthCheckTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Verifies that health is reported as healthy when persistence is available and all peers are within lag thresholds.
|
||||
/// Verifies that health is reported as healthy when persistence is available and all peers are within lag thresholds.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task CheckHealthAsync_WhenPersistenceOkAndPeersWithinLagThreshold_ReturnsHealthyWithPayload()
|
||||
@@ -52,7 +52,7 @@ public class CBDDCHealthCheckTests
|
||||
var healthCheck = new CBDDCHealthCheck(
|
||||
store,
|
||||
confirmationStore,
|
||||
CreateOptions(lagThresholdMs: 20, criticalLagThresholdMs: 50));
|
||||
CreateOptions(20, 50));
|
||||
|
||||
var result = await healthCheck.CheckHealthAsync(new HealthCheckContext());
|
||||
|
||||
@@ -69,7 +69,7 @@ public class CBDDCHealthCheckTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that health is reported as degraded when at least one peer is lagging or has no confirmation.
|
||||
/// Verifies that health is reported as degraded when at least one peer is lagging or has no confirmation.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task CheckHealthAsync_WhenPeersLaggingOrUnconfirmed_ReturnsDegradedWithPayload()
|
||||
@@ -113,7 +113,7 @@ public class CBDDCHealthCheckTests
|
||||
var healthCheck = new CBDDCHealthCheck(
|
||||
store,
|
||||
confirmationStore,
|
||||
CreateOptions(lagThresholdMs: 30, criticalLagThresholdMs: 100));
|
||||
CreateOptions(30, 100));
|
||||
|
||||
var result = await healthCheck.CheckHealthAsync(new HealthCheckContext());
|
||||
|
||||
@@ -130,7 +130,7 @@ public class CBDDCHealthCheckTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that health is reported as unhealthy when critical lag threshold is exceeded.
|
||||
/// Verifies that health is reported as unhealthy when critical lag threshold is exceeded.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task CheckHealthAsync_WhenCriticalLagBreached_ReturnsUnhealthyWithPayload()
|
||||
@@ -158,7 +158,7 @@ public class CBDDCHealthCheckTests
|
||||
var healthCheck = new CBDDCHealthCheck(
|
||||
store,
|
||||
confirmationStore,
|
||||
CreateOptions(lagThresholdMs: 30, criticalLagThresholdMs: 80));
|
||||
CreateOptions(30, 80));
|
||||
|
||||
var result = await healthCheck.CheckHealthAsync(new HealthCheckContext());
|
||||
|
||||
@@ -168,7 +168,7 @@ public class CBDDCHealthCheckTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that worst-case lag is used when a peer has multiple source confirmations.
|
||||
/// Verifies that worst-case lag is used when a peer has multiple source confirmations.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task CheckHealthAsync_WhenPeerHasMultipleSourceConfirmations_UsesWorstCaseLag()
|
||||
@@ -205,7 +205,7 @@ public class CBDDCHealthCheckTests
|
||||
var healthCheck = new CBDDCHealthCheck(
|
||||
store,
|
||||
confirmationStore,
|
||||
CreateOptions(lagThresholdMs: 80, criticalLagThresholdMs: 150));
|
||||
CreateOptions(80, 150));
|
||||
|
||||
var result = await healthCheck.CheckHealthAsync(new HealthCheckContext());
|
||||
|
||||
@@ -215,7 +215,7 @@ public class CBDDCHealthCheckTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that health is reported as unhealthy when the persistence store throws.
|
||||
/// Verifies that health is reported as unhealthy when the persistence store throws.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task CheckHealthAsync_WhenStoreThrows_ReturnsUnhealthy()
|
||||
@@ -253,4 +253,4 @@ public class CBDDCHealthCheckTests
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace ZB.MOM.WW.CBDDC.Hosting.Tests;
|
||||
public class CBDDCHostingExtensionsTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Verifies that adding CBDDC hosting throws when the service collection is null.
|
||||
/// Verifies that adding CBDDC hosting throws when the service collection is null.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void AddCBDDCHosting_WithNullServices_ThrowsArgumentNullException()
|
||||
@@ -22,7 +22,7 @@ public class CBDDCHostingExtensionsTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that adding CBDDC hosting throws when the configuration delegate is null.
|
||||
/// Verifies that adding CBDDC hosting throws when the configuration delegate is null.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void AddCBDDCHosting_WithNullConfigure_ThrowsArgumentNullException()
|
||||
@@ -33,7 +33,7 @@ public class CBDDCHostingExtensionsTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that single-cluster hosting registers expected services and configured options.
|
||||
/// Verifies that single-cluster hosting registers expected services and configured options.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void AddCBDDCHostingSingleCluster_RegistersExpectedServicesAndOptions()
|
||||
@@ -73,7 +73,7 @@ public class CBDDCHostingExtensionsTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that single-cluster hosting uses default options when no configuration delegate is provided.
|
||||
/// Verifies that single-cluster hosting uses default options when no configuration delegate is provided.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void AddCBDDCHostingSingleCluster_WithNullConfigure_UsesDefaults()
|
||||
@@ -90,17 +90,14 @@ public class CBDDCHostingExtensionsTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that health check registration is skipped when health checks are disabled.
|
||||
/// Verifies that health check registration is skipped when health checks are disabled.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void AddCBDDCHosting_WithHealthChecksDisabled_DoesNotRegisterCBDDCHealthCheck()
|
||||
{
|
||||
var services = new ServiceCollection();
|
||||
|
||||
services.AddCBDDCHosting(options =>
|
||||
{
|
||||
options.EnableHealthChecks = false;
|
||||
});
|
||||
services.AddCBDDCHosting(options => { options.EnableHealthChecks = false; });
|
||||
|
||||
services.Any(d => d.ServiceType == typeof(IConfigureOptions<HealthCheckServiceOptions>))
|
||||
.ShouldBeFalse();
|
||||
@@ -121,4 +118,4 @@ public class CBDDCHostingExtensionsTests
|
||||
d.ImplementationType == typeof(THostedService))
|
||||
.ShouldBeTrue();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +1,2 @@
|
||||
global using NSubstitute;
|
||||
global using Shouldly;
|
||||
global using Shouldly;
|
||||
@@ -7,7 +7,7 @@ namespace ZB.MOM.WW.CBDDC.Hosting.Tests;
|
||||
public class HostedServicesTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Verifies that the TCP sync server hosted service starts and stops the server lifecycle.
|
||||
/// Verifies that the TCP sync server hosted service starts and stops the server lifecycle.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task TcpSyncServerHostedService_StartAndStop_CallsServerLifecycle()
|
||||
@@ -24,7 +24,7 @@ public class HostedServicesTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that the discovery hosted service starts and stops the discovery lifecycle.
|
||||
/// Verifies that the discovery hosted service starts and stops the discovery lifecycle.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task DiscoveryServiceHostedService_StartAndStop_CallsDiscoveryLifecycle()
|
||||
@@ -39,4 +39,4 @@ public class HostedServicesTests
|
||||
await discoveryService.Received(1).Start();
|
||||
await discoveryService.Received(1).Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace ZB.MOM.WW.CBDDC.Hosting.Tests;
|
||||
public class NoOpServicesTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Verifies that no-op discovery service lifecycle calls complete and no peers are returned.
|
||||
/// Verifies that no-op discovery service lifecycle calls complete and no peers are returned.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task NoOpDiscoveryService_ReturnsNoPeers_AndCompletesLifecycleCalls()
|
||||
@@ -20,7 +20,7 @@ public class NoOpServicesTests
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that no-op sync orchestrator lifecycle calls complete without exceptions.
|
||||
/// Verifies that no-op sync orchestrator lifecycle calls complete without exceptions.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public async Task NoOpSyncOrchestrator_CompletesLifecycleCalls()
|
||||
@@ -32,4 +32,4 @@ public class NoOpServicesTests
|
||||
|
||||
orchestrator.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,32 +1,32 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<AssemblyName>ZB.MOM.WW.CBDDC.Hosting.Tests</AssemblyName>
|
||||
<RootNamespace>ZB.MOM.WW.CBDDC.Hosting.Tests</RootNamespace>
|
||||
<PackageId>ZB.MOM.WW.CBDDC.Hosting.Tests</PackageId>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<NoWarn>$(NoWarn);xUnit1031;xUnit1051</NoWarn>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<AssemblyName>ZB.MOM.WW.CBDDC.Hosting.Tests</AssemblyName>
|
||||
<RootNamespace>ZB.MOM.WW.CBDDC.Hosting.Tests</RootNamespace>
|
||||
<PackageId>ZB.MOM.WW.CBDDC.Hosting.Tests</PackageId>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<NoWarn>$(NoWarn);xUnit1031;xUnit1051</NoWarn>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.4" />
|
||||
<PackageReference Include="NSubstitute" Version="5.3.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
|
||||
<PackageReference Include="Shouldly" Version="4.3.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4" />
|
||||
<PackageReference Include="xunit.v3" Version="3.2.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="coverlet.collector" Version="6.0.4"/>
|
||||
<PackageReference Include="NSubstitute" Version="5.3.0"/>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0"/>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1"/>
|
||||
<PackageReference Include="Shouldly" Version="4.3.0"/>
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.4"/>
|
||||
<PackageReference Include="xunit.v3" Version="3.2.0"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Using Include="Xunit"/>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ZB.MOM.WW.CBDDC.Hosting\ZB.MOM.WW.CBDDC.Hosting.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\ZB.MOM.WW.CBDDC.Hosting\ZB.MOM.WW.CBDDC.Hosting.csproj"/>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user