mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-12 11:55:24 +08:00
d843898cb8
* tests: clean-up * tests: missed warnings & exceptions fix * build: comments fix * docs: xml comments fixed to stop warnings
35 lines
1.1 KiB
C#
35 lines
1.1 KiB
C#
using System;
|
|
using System.Globalization;
|
|
using AntDesign.JsInterop;
|
|
using Bunit;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Moq;
|
|
|
|
namespace AntDesign.Tests
|
|
{
|
|
public class AntDesignTestBase : TestContext, IDisposable
|
|
{
|
|
public TestContext Context => this;
|
|
public NavigationManager NavigationManager => Services.GetRequiredService<NavigationManager>();
|
|
|
|
public Mock<IDomEventListener> MockedDomEventListener { get; set; } = new Mock<IDomEventListener>();
|
|
|
|
public AntDesignTestBase(bool useMoq = false)
|
|
{
|
|
Services.AddAntDesign();
|
|
|
|
//Needed for Tests using Overlay
|
|
Services.AddScoped<AntDesign.JsInterop.DomEventService>(sp => new TestDomEventService(Context.JSInterop.JSRuntime, MockedDomEventListener));
|
|
JSInterop.SetupVoid(JSInteropConstants.OverlayComponentHelper.DeleteOverlayFromContainer, _ => true);
|
|
|
|
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.GetCultureInfo("en-US");
|
|
}
|
|
|
|
public new void Dispose()
|
|
{
|
|
Context?.Dispose();
|
|
}
|
|
}
|
|
}
|