public void Can_pass_valid_entity() { Expect.Call(_instancePlugin.Validate(_youngDog)).Return(new List <string>()); _mockery.ReplayAll(); Assert.That(() => Validator.This(_youngDog).IsValid(), Throws.Nothing); _mockery.VerifyAll(); }
public void Should_throws_invalid_entity_exception_to_invalid_entity() { Expect.Call(_instancePlugin.Validate(_oldDog)).Return(new List <string>() { "There's no dog so old" }); _mockery.ReplayAll(); Assert.That(() => Validator.This(_oldDog).IsValid(), Throws.TypeOf <InvalidEntityException>()); _mockery.VerifyAll(); }
public void Should_not_return_messages_valid_entity() { var expected = new List <string>(); Expect.Call(_instancePlugin.Validate(_youngDog)).Return(new List <string>()); _mockery.ReplayAll(); var actual = Validator.This(_youngDog).HasMessages(); Assert.That(actual, Is.EqualTo(expected)); _mockery.VerifyAll(); }
public void Should_return_validation_messages_to_invalid_entity() { var expected = new System.Collections.Generic.List <string>() { "There's no dog so old" }; Expect.Call(_instancePlugin.Validate(_oldDog)).Return(new List <string>() { "There's no dog so old" }); _mockery.ReplayAll(); var actual = Validator.This(_oldDog).HasMessages(); Assert.That(actual, Is.EqualTo(expected)); _mockery.VerifyAll(); }