2026-07-19 20:53:48 +00:00
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using MudBlazor;
|
|
|
|
|
using MudBlazor.Services;
|
|
|
|
|
|
2026-07-17 17:39:30 +00:00
|
|
|
namespace Heimdall.Web.Tests;
|
|
|
|
|
|
2026-07-19 20:53:48 +00:00
|
|
|
public class MudBlazorServicesTests
|
2026-07-17 17:39:30 +00:00
|
|
|
{
|
|
|
|
|
[Fact]
|
2026-07-19 20:53:48 +00:00
|
|
|
public void AddMudServices_ConfiguresServiceCollection()
|
|
|
|
|
{
|
|
|
|
|
var services = new ServiceCollection();
|
|
|
|
|
services.AddMudServices(config =>
|
|
|
|
|
{
|
|
|
|
|
config.SnackbarConfiguration.PositionClass = "mud-alert-center-top";
|
|
|
|
|
config.SnackbarConfiguration.PreventDuplicates = true;
|
|
|
|
|
config.SnackbarConfiguration.VisibleStateDuration = 4000;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// Verify services were added by checking that ISnackbar is registered
|
|
|
|
|
var descriptor = services.FirstOrDefault(s => s.ServiceType == typeof(ISnackbar));
|
|
|
|
|
Assert.NotNull(descriptor);
|
|
|
|
|
Assert.Equal(ServiceLifetime.Scoped, descriptor.Lifetime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
public void AddMudServices_RegistersDialogService()
|
|
|
|
|
{
|
|
|
|
|
var services = new ServiceCollection();
|
|
|
|
|
services.AddMudServices();
|
|
|
|
|
|
|
|
|
|
var descriptor = services.FirstOrDefault(s => s.ServiceType == typeof(IDialogService));
|
|
|
|
|
Assert.NotNull(descriptor);
|
|
|
|
|
}
|
2026-07-17 17:39:30 +00:00
|
|
|
}
|