void Ex02() { When("the property1 binds the property2", () => Property1.Bind(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", () => 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"); }
void Ex02() { When("the property1 binds the property2 with a converter", () => Property1.Bind(Property2, value => value.ToString())); 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", () => Property1.Unbind()); 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); }
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"); }
void Ex04() { When("the property1 unbinds", () => Property1.Unbind()); Then <InvalidOperationException>($"{typeof(InvalidOperationException)} should be thrown"); }