public void CriticaQuandoEmailInvalidoEmObterClientePorEmail() { var command = new ObterClientePorEmailCommand(); command.Email = faker.Person.FirstName; var handler = new ClienteHandler(null); var result = handler.Handle(command); Assert.IsFalse(result.Success); }
public void SucessoQuandoClienteEncontrado() { clienteRepository.Setup(r => r.ObterClientePorEmail(clientes.First().Email.EnderecoEmail)).Returns(clientes.First()); var handler = new ClienteHandler(clienteRepository.Object); var command = new ObterClientePorEmailCommand(); command.Email = clientes.First().Email.EnderecoEmail; var result = handler.Handle(command); Assert.IsTrue(result.Success); Assert.AreEqual(clientes.First().Id, ((Cliente)result.Content).Id); }
public void CriticaQuandoClienteNaoEncontrado() { clienteRepository.Setup(r => r.ObterClientePorEmail(clientes.First().Email.EnderecoEmail)).Returns((Cliente)null); var command = new ObterClientePorEmailCommand(); command.Email = faker.Person.Email; var handler = new ClienteHandler(clienteRepository.Object); var result = handler.Handle(command); Assert.IsFalse(result.Success); Assert.AreEqual("Cliente não encontrado", result.Message); }