Initial import of the CBDDC codebase with docs and tests. Add a .NET-focused gitignore to keep generated artifacts out of source control.
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
Joseph Doherty
2026-02-20 13:03:21 -05:00
commit 08bfc17218
218 changed files with 33910 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
using Microsoft.Extensions.Logging;
using ZB.MOM.WW.CBDDC.Hosting.HostedServices;
using ZB.MOM.WW.CBDDC.Network;
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.
/// </summary>
[Fact]
public async Task TcpSyncServerHostedService_StartAndStop_CallsServerLifecycle()
{
var syncServer = Substitute.For<ISyncServer>();
var logger = Substitute.For<ILogger<TcpSyncServerHostedService>>();
var hostedService = new TcpSyncServerHostedService(syncServer, logger);
await hostedService.StartAsync(CancellationToken.None);
await hostedService.StopAsync(CancellationToken.None);
await syncServer.Received(1).Start();
await syncServer.Received(1).Stop();
}
/// <summary>
/// Verifies that the discovery hosted service starts and stops the discovery lifecycle.
/// </summary>
[Fact]
public async Task DiscoveryServiceHostedService_StartAndStop_CallsDiscoveryLifecycle()
{
var discoveryService = Substitute.For<IDiscoveryService>();
var logger = Substitute.For<ILogger<DiscoveryServiceHostedService>>();
var hostedService = new DiscoveryServiceHostedService(discoveryService, logger);
await hostedService.StartAsync(CancellationToken.None);
await hostedService.StopAsync(CancellationToken.None);
await discoveryService.Received(1).Start();
await discoveryService.Received(1).Stop();
}
}