예제 #1
0
    void Ex01()
    {
        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 value of the property2 is changed", () => Property2.Value = "Changed");
        Then("the value of the property1 should be the changed value", () => Property1.Value == "Changed");
        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 be the changed value", () => Property2.Value == "Test");
    }
예제 #2
0
    void Ex03()
    {
        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 without the property2", () => Property1.Unbind());
        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 be the changed value", () => Property2.Value == "Test");

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

        When("the value of the property1 is changed", () => Property1.Value = "TestTest");
        Then("the value of the property1 should be the changed value", () => Property1.Value == "TestTest");
        Then("the value of the property2 should not be changed", () => Property2.Value == "Modified");
    }
예제 #3
0
 void Ex04()
 {
     When("the property1 binds the property2 as two way binding", () => Property1.BindTwoWay(Property2));
     When("the property1 binds another property as two way binding", () => Property1.BindTwoWay(ObservableProperty <string> .Of("Test")));
     Then <InvalidOperationException>($"{typeof(InvalidOperationException)} should be thrown");
 }
 void Ex03()
 {
     When("the property1 binds the property2 as two way binding with converters", () => Property1.BindTwoWay(Property2, value => value.ToString(), int.Parse));
     When("the property1 binds another property as two way binding with converters", () => Property1.BindTwoWay(ObservableProperty <int> .Of(8), value => value.ToString(), int.Parse));
     Then <InvalidOperationException>($"{typeof(InvalidOperationException)} should be thrown");
 }
    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);
    }
 void Ex06()
 {
     When("the property1 binds the property that is null as two way binding", () => Property1.BindTwoWay(null));
     Then <ArgumentNullException>($"{typeof(ArgumentNullException)} should be thrown");
 }
 void Ex06()
 {
     When("the property1 binds the property2 as two way binding with converters whose back converter is null", () => Property1.BindTwoWay(Property2, value => value.ToString(), null));
     Then <ArgumentNullException>($"{typeof(ArgumentNullException)} should be thrown");
 }
 void Ex05()
 {
     When("the property1 binds the property2 as two way binding with converters whose converter is null", () => Property1.BindTwoWay(Property2, null, int.Parse));
     Then <ArgumentNullException>($"{typeof(ArgumentNullException)} should be thrown");
 }
 void Ex04()
 {
     When("the property1 binds the property that is null as two way binding with converters", () => Property1.BindTwoWay(null, value => value.ToString(), int.Parse));
     Then <ArgumentNullException>($"{typeof(ArgumentNullException)} should be thrown");
 }