public void IsValidShouldReturnTrueAllItemsAreValid() { // arrange var item1 = new Mock<ValidatableObject>(); var item2 = new Mock<ValidatableObject>(); item1.SetupGet( i => i.IsValid ).Returns( true ); item2.SetupGet( i => i.IsValid ).Returns( true ); var items = new[] { item1.Object, item2.Object }; // act var valid = items.IsValid(); // assert Assert.True( valid ); }
public void IsValidShouldReturnFalseWhenAnyItemIsInvalid() { // arrange var item1 = new Mock<ValidatableObject>(); var item2 = new Mock<ValidatableObject>(); item1.SetupGet( i => i.IsValid ).Returns( true ); item2.SetupGet( i => i.IsValid ).Returns( false ); var items = new[] { item1.Object, item2.Object }; // act var valid = items.IsValid(); // assert Assert.False( valid ); }