Esempio n. 1
0
    void Ex02()
    {
        When("the property1 binds the property2 as two way binding", () => Property1.BindTwoWay(Property2));
        Then("the value of the property1 should be the value of the property2", () => Property1.Value == "Test2");
        Then("the value of the property2 should not be changed", () => Property2.Value == "Test2");

        When("the property1 unbinds the property2", () => Property1.UnbindTwoWay(Property2));
        When("the value of the property2 is changed", () => Property2.Value = "Changed");
        Then("the value of the property1 should not be changed", () => Property1.Value == "Test2");
        Then("the value of the property2 should be the changed value", () => Property2.Value == "Changed");

        When("the value of the property1 is changed", () => Property1.Value = "Test");
        Then("the value of the property1 should be the changed value", () => Property1.Value == "Test");
        Then("the value of the property2 should not be changed", () => Property2.Value == "Changed");
    }
    void Ex02()
    {
        When("the property1 binds the property2 as two way binding with converters", () => Property1.BindTwoWay(Property2, value => value.ToString(), int.Parse));
        Then("the value of the property1 should be the converted value of the property2", () => Property1.Value == "3");
        Then("the value of the property2 should not be changed", () => Property2.Value == 3);

        When("the property1 unbinds the property2", () => Property1.UnbindTwoWay(Property2));
        When("the value of the property2 is changed", () => Property2.Value = 7);
        Then("the value of the property1 should not be changed", () => Property1.Value == "3");
        Then("the value of the property2 should be the changed value", () => Property2.Value == 7);

        When("the value of the property1 is changed", () => Property1.Value = "Test");
        Then("the value of the property1 should be the changed value", () => Property1.Value == "Test");
        Then("the value of the property2 should not be changed", () => Property2.Value == 7);
    }
Esempio n. 3
0
 void Ex05()
 {
     When("the property1 unbinds the property2", () => Property1.UnbindTwoWay(Property2));
     Then <InvalidOperationException>($"{typeof(InvalidOperationException)} should be thrown");
 }