Ejemplo n.º 1
0
        public void ShouldValidateWhenCommandIsValid()
        {
            var cmd = new CreateCustomerCommand();

            cmd.FirstName = "Alex";
            cmd.LastName  = "Canario";
            cmd.Document  = "73120162515";
            cmd.Email     = "*****@*****.**";
            cmd.Phone     = "71 9.9183-2956";

            Assert.AreEqual(true, cmd.Validated());
        }
Ejemplo n.º 2
0
        public void ShouldRegisterCustomerWhenCommandIsValid()
        {
            var command = new CreateCustomerCommand();

            command.FirstName = "Alex";
            command.LastName  = "Canario";
            command.Document  = "73120162515";
            command.Email     = "*****@*****.**";
            command.Phone     = "71 9.9183-2956";

            Assert.AreEqual(true, command.Validated());

            var customer = new CustomerHandler(new FakeCustomerRepository(), new FakeEmailService());
            var result   = customer.Handle(command);

            Assert.AreEqual(true, customer.IsValid);
            Assert.AreNotEqual(null, result);
        }