示例#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());
        }
        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);
        }