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.UpdateTenant;
|
|
using CleanArchitecture.Domain.Enums;
|
|
using CleanArchitecture.Domain.Interfaces.Repositories;
|
|
using NSubstitute;
|
|
|
|
namespace CleanArchitecture.Domain.Tests.CommandHandler.Tenant.UpdateTenant;
|
|
|
|
public sealed class UpdateTenantCommandTestFixture : CommandHandlerFixtureBase
|
|
{
|
|
public UpdateTenantCommandTestFixture()
|
|
{
|
|
TenantRepository = Substitute.For<ITenantRepository>();
|
|
|
|
CommandHandler = new UpdateTenantCommandHandler(
|
|
Bus,
|
|
UnitOfWork,
|
|
NotificationHandler,
|
|
TenantRepository,
|
|
User);
|
|
}
|
|
|
|
public UpdateTenantCommandHandler CommandHandler { get; }
|
|
|
|
private ITenantRepository TenantRepository { get; }
|
|
|
|
public void SetupUser()
|
|
{
|
|
User.GetUserRole().Returns(UserRole.User);
|
|
}
|
|
|
|
public void SetupExistingTenant(Guid id)
|
|
{
|
|
TenantRepository
|
|
.GetByIdAsync(Arg.Is<Guid>(x => x == id))
|
|
.Returns(new Entities.Tenant(id, "Test Tenant"));
|
|
}
|
|
} |