Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
        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);
        }