public void WhenNoChildInfo_ThenThrows() { this.rule.Maximum = 1; this.rule.Minimum = 1; this.rule.ChildElementName = "Bar"; Assert.Throws <InvalidOperationException>(() => rule.Validate().ToList()); }
public void WhenNoChildElementName_ThenThrows() { var rule = new CardinalityValidationRule(); Assert.Throws <ValidationException>( () => rule.Validate().ToList()); }
public void WhenMinimunIsGreaterThanMaximun_ThenThrows() { var rule = new CardinalityValidationRule(); rule.ChildElementName = "Foo"; rule.Maximum = 1; rule.Minimum = 3; rule.CurrentElement = new Mock <IProduct>().Object; Assert.Throws <InvalidOperationException>(() => rule.Validate().ToList()); }