public async Task Calcula_taxa_de_juros_com_sucesso(decimal valorInicial, int quantidadeMeses, decimal taxaJuros, decimal resultadoCalculado) { //Arranges var command = CalculaJurosCommand.Factory.Create(valorInicial, quantidadeMeses, taxaJuros); //Setup's var mockMediator = new Mock <IMediator>(); var mockNotificationHandler = new Mock <DomainNotificationHandler>(); //Act var commandHandlers = new CalculaJurosCommandHandlers(mockMediator.Object, mockNotificationHandler.Object); var result = await commandHandlers.Handle(command, CancellationToken.None); //Asserts result.Should().BeGreaterThan(0); result.Should().Be(105.10M); mockMediator.Verify(x => x.Publish(It.IsAny <DomainNotification>(), CancellationToken.None), Times.Never()); }
public async Task Calcula_taxa_de_juros(decimal valorInicial, int quantidadeMeses, decimal taxaJuros) { //Arranges var command = CalculaJurosCommand.Factory.Create(valorInicial, quantidadeMeses, taxaJuros); //Setup's var mockMediator = new Mock <IMediator>(); var mockNotificationHandler = new Mock <DomainNotificationHandler>(); mockNotificationHandler.SetupGet(x => x.HasNotifications).Returns(true); //Act var commandHandlers = new CalculaJurosCommandHandlers(mockMediator.Object, mockNotificationHandler.Object); var result = await commandHandlers.Handle(command, CancellationToken.None); //Asserts mockMediator.Verify(x => x.Publish(It.IsAny <DomainNotification>(), CancellationToken.None), Times.Once); result.Should().Be(0); }