using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
namespace ScadaLink.Communication.Tests;
///
/// WP-2: Tests for CommunicationService initialization and state.
///
public class CommunicationServiceTests
{
[Fact]
public async Task BeforeInitialization_ThrowsOnUsage()
{
var options = Options.Create(new CommunicationOptions());
var logger = NullLogger.Instance;
var service = new CommunicationService(options, logger);
// CommunicationService requires SetCommunicationActor before use
await Assert.ThrowsAsync(() =>
service.DeployInstanceAsync("site1",
new Commons.Messages.Deployment.DeployInstanceCommand(
"dep1", "inst1", "hash1", "{}", "admin", DateTimeOffset.UtcNow)));
}
[Fact]
public void UnsubscribeDebugView_IsTellNotAsk()
{
// Verify the method signature is void (fire-and-forget Tell pattern)
var method = typeof(CommunicationService).GetMethod("UnsubscribeDebugView");
Assert.NotNull(method);
Assert.Equal(typeof(void), method!.ReturnType);
}
}