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

            command.FirstName = "Douglas";
            command.LastName  = "Costa";
            command.Document  = "28659170377";
            command.Email     = "*****@*****.**";

            Assert.AreEqual(true, command.IsValid());
            Assert.AreEqual(0, command.Notifications.Count);
        }
Ejemplo n.º 2
0
        public void ShouldValidateWhenCommandIsValid()
        {
            var command = new CreateCustomerCommand();

            command.FirstName = "Otavio";
            command.LastName  = "Araujo";
            command.Document  = "467181155";
            command.Email     = "*****@*****.**";
            command.Phone     = "551999876542";

            Assert.AreEqual(true, command.IsValid());
        }
Ejemplo n.º 3
0
        public void Deve_Validar_Se_Comando_Esta_Valido()
        {
            var command = new CreateCustomerCommand();

            command.FirstName = "Andre";
            command.LastName  = "Machado";
            command.Document  = "45455717863";
            command.Email     = "*****@*****.**";
            command.Phone     = "1198213781287";

            Assert.AreEqual(true, command.IsValid());
        }
Ejemplo n.º 4
0
        public void ShouldValidateWhenCommandIsValid()
        {
            var command = new CreateCustomerCommand();

            command.FirstName = "O Grande";
            command.LastName  = "Saitama";
            command.Document  = "16321365203";

            command.Email     = "*****@*****.**";
            command.Phone     = "2560-6969";
            command.BirthDate = "19/04/1970";

            Assert.AreEqual(true, command.IsValid());
        }
        public void ShouldRegisterCustomerWhenCommandIsValid()
        {
            var command = new CreateCustomerCommand();

            command.FirstName = "Douglas";
            command.LastName  = "Costa";
            command.Document  = "28659170377";
            command.Email     = "*****@*****.**";

            Assert.AreEqual(true, command.IsValid());
            Assert.AreEqual(0, command.Notifications.Count);

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

            Assert.AreNotEqual(null, result);
            Assert.AreEqual(true, handler.Valid);
        }