2021-05-07 16:54:21 +02:00
|
|
|
using Bunit;
|
|
|
|
|
using MediatR;
|
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Moq;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using Radzen;
|
|
|
|
|
using WotBlitzStatisticsPro.Blazor.Services;
|
|
|
|
|
|
|
|
|
|
namespace WotBlitzStatisticsPro.Blazor.Tests
|
|
|
|
|
{
|
|
|
|
|
public class TestContextBase: TestContextWrapper
|
|
|
|
|
{
|
|
|
|
|
protected Mock<IMediator> MediatorMock;
|
|
|
|
|
protected Mock<ISearchDialogService> SearchServiceMock;
|
2021-05-16 22:04:42 +02:00
|
|
|
protected Mock<INotificationsService> NotificationsServiceMock;
|
2021-05-07 16:54:21 +02:00
|
|
|
protected MockNavigationManager NavigationManagerMock;
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
|
protected void Init()
|
|
|
|
|
{
|
|
|
|
|
MediatorMock = new();
|
|
|
|
|
SearchServiceMock = new();
|
|
|
|
|
NavigationManagerMock = new();
|
2021-05-16 22:04:42 +02:00
|
|
|
NotificationsServiceMock = new ();
|
2021-05-07 16:54:21 +02:00
|
|
|
|
|
|
|
|
TestContext = new Bunit.TestContext();
|
|
|
|
|
TestContext.Services.AddSingleton(MediatorMock.Object);
|
|
|
|
|
TestContext.Services.AddLocalization();
|
|
|
|
|
|
|
|
|
|
TestContext.Services.AddSingleton<DialogService>();
|
2021-05-16 22:04:42 +02:00
|
|
|
TestContext.Services.AddSingleton<NotificationService>();
|
2021-07-21 16:10:24 +02:00
|
|
|
TestContext.Services.AddSingleton<TooltipService>();
|
2021-05-07 16:54:21 +02:00
|
|
|
TestContext.Services.AddSingleton(SearchServiceMock.Object);
|
2021-05-16 22:04:42 +02:00
|
|
|
TestContext.Services.AddSingleton(NotificationsServiceMock.Object);
|
2021-05-07 16:54:21 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
TestContext.Services.AddSingleton<NavigationManager>(NavigationManagerMock);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TearDown]
|
|
|
|
|
public void TearDown() => TestContext?.Dispose();
|
|
|
|
|
}
|
|
|
|
|
}
|