-
-
Notifications
You must be signed in to change notification settings - Fork 377
Closed
Labels
questionFurther information is requestedFurther information is requested
Description
I don't know if you guys use BUnit, component to test Blazor.
I'm trying to initialize the IMatDialogService, but I can't manually initialize this service.
ctx.RegisterDialogService(typeof(ChangeDialog), new());
public static void RegisterDialogService(this TestContext ctx, Type componentType, Dictionary<string, object> attributes)
{
var services = new MatPortalService();
services.Add(componentType, attributes);
ctx.Services.AddSingleton<IMatDialogService>(new MatDialogService(services));
}
var cut = ctx.RenderComponent<ChangeDialog>(parameters => parameters
.Add(p => p.DialogReference, new MatDialogReference() { Service = new MatDialogService(new MatPortalService()) })
);
var att = new Dictionary<string, object>
{
{ "VariableName", "xyz" },
{ "VariableValue", "xyz" },
{ "VariableType", VariableType.SingleLine }
};
await cut.Instance.DialogReference.Service.OpenAsync(typeof(ChangeDialog), new MatDialogOptions() { Attributes = att });
when I run that last line of code, the system crashes.
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested