コード例 #1
0
 void Ex02()
 {
     When("the property validation is enabled", () => PropertyAttributedValidation.EnableValidation(() => PropertyAttributedValidation));
     When("the invalid value is set", () => SetValue("long values", PropertyAttributedValidation));
     Then("the ErrorChanged event should be raised", () => ErrorsChangedRaised);
     AssertValidationError(PropertyAttributedValidation, "Please enter String Expression within 10 characters.");
 }
コード例 #2
0
 void Ex10()
 {
     When("the property validation is enabled", () => PropertyAttributedValidation.EnableValidation(() => PropertyAttributedValidation));
     When("the PropertyValueValidate event handler is added", () => PropertyAttributedValidation.PropertyValueValidate += PropertyValueValidateHandler);
     When("the invalid value is set", () => SetValue("long values", PropertyAttributedValidation));
     Then("the ErrorsChanged event should be raised", () => ErrorsChangedRaised);
     AssertValidationError(PropertyAttributedValidation, "Please enter String Expression within 10 characters.", "The value does not correct.");
 }
コード例 #3
0
    void Ex12()
    {
        When("the property validation is enabled with cancelValueChangedIfInvalid", () => PropertyAttributedValidation.EnableValidation(() => PropertyAttributedValidation, true));
        When("the valid value is set", () => SetValue("short word", PropertyAttributedValidation));
        Then("the value of the property should be the changed value", () => PropertyAttributedValidation.Value == "short word");

        When("the invalid value is set", () => SetValue("long values", PropertyAttributedValidation));
        Then("the value of the property should not be changed", () => PropertyAttributedValidation.Value == "short word");
    }