using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using ScadaLink.AuditLog.Configuration; namespace ScadaLink.AuditLog.Tests; /// /// Bundle E (M1) smoke tests for the Audit Log (#23) DI scaffold. Verifies /// AddAuditLog registers against the /// AuditLog configuration section. Bundle E ships only the scaffold; /// the validator + full options surface land in Task 9. /// public class AddAuditLogTests { [Fact] public void AddAuditLog_RegistersAuditLogOptions() { var config = new ConfigurationBuilder() .AddInMemoryCollection(new Dictionary()) .Build(); var services = new ServiceCollection(); services.AddAuditLog(config); var provider = services.BuildServiceProvider(); var opts = provider.GetService>(); Assert.NotNull(opts); Assert.NotNull(opts!.Value); } [Fact] public void AddAuditLog_NullServices_Throws() { var config = new ConfigurationBuilder().Build(); Assert.Throws( () => ServiceCollectionExtensions.AddAuditLog(null!, config)); } [Fact] public void AddAuditLog_NullConfig_Throws() { var services = new ServiceCollection(); Assert.Throws( () => services.AddAuditLog(null!)); } }