Exemplo n.º 1
0
 public void When_Raise_Append_Handle()
 {
     FakeContainer.Create().Add <IHandle <MessageTest> >(new Handle <MessageTest>());
     Message.Raise(new MessageTest("TEST_CASE", "TEST MESSAGE"));
     Assert.AreEqual("MessageTest", Locator.Service <IHandle <MessageTest> >().Key);
     Assert.True(Locator.Service <IHandle <MessageTest> >().Any());
 }
Exemplo n.º 2
0
        public void When_Invalid_Model_No_Call_Repository()
        {
            FakeContainer.Create().Add <IHandle <ValidationError> >(new Handle <ValidationError>());
            var customer = new Customer {
                Name = "AG", BirthDate = DateTime.Today.AddYears(-3)
            };

            _service.Insert(customer);
            _repo.Verify(r => r.Insert(customer), Times.Never);
        }
Exemplo n.º 3
0
        public void When_Invalid_Raise_Messages()
        {
            var validator = new CustomerValidator();
            var customer  = new Customer();

            FakeContainer.Create().Add <IHandle <ValidationError> >(new ValidationErrorHandle());

            Assert.False(validator.Validate(customer));
            var handle = Locator.Service <IHandle <ValidationError> >();

            Assert.True(handle.Any());
        }