public void ContaExistenteMasNotificacaoNaoFuncionando_ChamadoDocumentoValido_RetornarFalha() { // Arrange var fixture = new Fixture(); var contaCorrente = fixture.Create <ContaCorrente>(); var respostaNotificacaoViewModel = RespostaNotificacaoViewModelFactory.ObterRespostaFalha(); var contaCorrenteRepositoryMock = new Mock <IContaCorrenteRepository>(); var notificacaoServiceMock = new Mock <INotificacaoService>(); contaCorrenteRepositoryMock.Setup(ccr => ccr.ObterPorDocumento(contaCorrente.Documento)).Returns(contaCorrente); notificacaoServiceMock.Setup(ns => ns.Notificar(contaCorrente)).Returns(respostaNotificacaoViewModel); var contaCorrenteService = new ContaCorrenteService(notificacaoServiceMock.Object, contaCorrenteRepositoryMock.Object); // Act var resposta = contaCorrenteService.NotificarContaCorrente(contaCorrente.Documento); // Assert contaCorrenteRepositoryMock.Verify(ccr => ccr.ObterPorDocumento(contaCorrente.Documento), Times.Once); notificacaoServiceMock.Verify(ns => ns.Notificar(It.IsAny <ContaCorrente>()), Times.Once); Assert.False(resposta); }
public void ContaExistenteNotificacaoFuncionando_ChamadoDocumentoValido_RetornarSucesso() { // Arrange var fixture = new Fixture(); var contaCorrente = fixture.Create <ContaCorrente>(); // ANTES: var contaCorrente = ContaCorrenteFactory.GetContaOrigemValida(); fixture.RepeatCount = 5; var operacoes = fixture.CreateMany <OperacaoContaCorrente>().ToList(); var respostaNotificacaoViewModel = RespostaNotificacaoViewModelFactory.ObterRespostaSucesso(); var contaCorrenteRepositoryMock = new Mock <IContaCorrenteRepository>(); var notificacaoServiceMock = new Mock <INotificacaoService>(); contaCorrenteRepositoryMock.Setup(ccr => ccr.ObterPorDocumento(contaCorrente.Documento)).Returns(contaCorrente); notificacaoServiceMock.Setup(ns => ns.Notificar(contaCorrente)).Returns(respostaNotificacaoViewModel); var contaCorrenteService = new ContaCorrenteService(notificacaoServiceMock.Object, contaCorrenteRepositoryMock.Object); // Act var resposta = contaCorrenteService.NotificarContaCorrente(contaCorrente.Documento); // Assert contaCorrenteRepositoryMock.Verify(ccr => ccr.ObterPorDocumento(contaCorrente.Documento), Times.Once); notificacaoServiceMock.Verify(ns => ns.Notificar(It.IsAny <ContaCorrente>()), Times.Once); Assert.True(resposta); }