public void RemoveConstraint_IfConstraintsContainConstrait_ReturnConstraint() { //Arrange Constraint<RecWrapper> constraint = new TextSizeConstraint<RecWrapper> { Property = new TextProperty() }; _constraintCollection.AddConstraint(constraint); //Act var actual = _constraintCollection.RemoveConstraint(constraint); //Assert Assert.AreEqual(constraint, actual); }
public void RemoveConstraint_IfConstraintsNotContainConstrait_ReturnNull() { //Arrange var constraint = new TextSizeConstraint<RecWrapper>(); //Act var actual = _constraintCollection.RemoveConstraint(constraint); //Assert Assert.IsNull(actual); }
public void Apply_IfTTypeTargetIsNotNullAndObjectIsNull_ReturnNextInstructionDo() { //Arrange var target = new RecWrapper(); object context = null; var constraint = new TextSizeConstraint<RecWrapper> { Property = new TextProperty() { PropertyInfo = target.GetType().GetProperty("ComputerName", BindingFlags.Public | BindingFlags.Instance) } }; constraint.Property.SetValue(target, context, "value"); _constraintCollection.AddConstraint(constraint); //Act // ReSharper disable ExpressionIsAlwaysNull var actual = _constraintCollection.Apply(target, context); // ReSharper restore ExpressionIsAlwaysNull //Assert Assert.AreEqual(NextInstruction.Do, actual); }