mirror of
https://github.com/alex289/CleanArchitecture.git
synced 2025-06-29 18:21:08 +00:00
38 lines
1.0 KiB
C#
38 lines
1.0 KiB
C#
using System;
|
|
using CleanArchitecture.Domain.Commands.Tenants.CreateTenant;
|
|
using CleanArchitecture.Domain.Enums;
|
|
using CleanArchitecture.Domain.Interfaces.Repositories;
|
|
using NSubstitute;
|
|
|
|
namespace CleanArchitecture.Domain.Tests.CommandHandler.Tenant.CreateTenant;
|
|
|
|
public sealed class CreateTenantCommandTestFixture : CommandHandlerFixtureBase
|
|
{
|
|
public CreateTenantCommandTestFixture()
|
|
{
|
|
TenantRepository = Substitute.For<ITenantRepository>();
|
|
|
|
CommandHandler = new CreateTenantCommandHandler(
|
|
Bus,
|
|
UnitOfWork,
|
|
NotificationHandler,
|
|
TenantRepository,
|
|
User);
|
|
}
|
|
|
|
public CreateTenantCommandHandler CommandHandler { get; }
|
|
|
|
private ITenantRepository TenantRepository { get; }
|
|
|
|
public void SetupUser()
|
|
{
|
|
User.GetUserRole().Returns(UserRole.User);
|
|
}
|
|
|
|
public void SetupExistingTenant(Guid id)
|
|
{
|
|
TenantRepository
|
|
.ExistsAsync(Arg.Is<Guid>(x => x == id))
|
|
.Returns(true);
|
|
}
|
|
} |