public async Task UpdateSistemaCommand_Handle()
    {
        // Arrange
        IUnitOfWork unitOfWork = DbContextHelper.GetContext();
        IMapper     mapper     = AutoMapperHelper.GetMappings();

        Mock <IEventHandler> mockServiceBus           = ServiceBusHelper.GetInstance();
        Mock <IHubContext <CpnucleoHub> > mockSignalR = SignalRHelper.GetInstance();

        Guid     sistemaId    = Guid.NewGuid();
        DateTime dataInclusao = DateTime.Now;

        Sistema sistema = MockEntityHelper.GetNewSistema(sistemaId);

        await unitOfWork.SistemaRepository.AddAsync(sistema);

        await unitOfWork.SaveChangesAsync();

        unitOfWork.SistemaRepository.Detatch(sistema);

        UpdateSistemaCommand request = new()
        {
            Sistema = MockViewModelHelper.GetNewSistema(sistemaId, dataInclusao)
        };

        GetSistemaQuery request2 = new()
        {
            Id = sistemaId
        };

        // Act
        SistemaHandler  handler  = new(unitOfWork, mapper, mockServiceBus.Object, mockSignalR.Object);
        OperationResult response = await handler.Handle(request, CancellationToken.None);

        SistemaViewModel response2 = await handler.Handle(request2, CancellationToken.None);

        // Assert
        Assert.True(response == OperationResult.Success);
        Assert.True(response2 != null);
        Assert.True(response2.Id == sistemaId);
        Assert.True(response2.DataInclusao.Ticks == dataInclusao.Ticks);
    }
}
    public async Task CreateSistemaCommand_Handle()
    {
        // Arrange
        IUnitOfWork unitOfWork = DbContextHelper.GetContext();
        IMapper     mapper     = AutoMapperHelper.GetMappings();

        Mock <IEventHandler> mockServiceBus           = ServiceBusHelper.GetInstance();
        Mock <IHubContext <CpnucleoHub> > mockSignalR = SignalRHelper.GetInstance();

        CreateSistemaCommand request = new()
        {
            Sistema = MockViewModelHelper.GetNewSistema()
        };

        // Act
        SistemaHandler  handler  = new(unitOfWork, mapper, mockServiceBus.Object, mockSignalR.Object);
        OperationResult response = await handler.Handle(request, CancellationToken.None);

        // Assert
        Assert.True(response == OperationResult.Success);
    }