void Ex02()
 {
     Given("a property whose value is not null", () => Property = ObservableProperty <string> .Of("Test"));
     Given("a BoundProperty that binds a given property", () => BoundProperty = BoundProperty <string> .Of(null).Bind(Property));
     When("the property value changing handler in which the value changing is canceled is added", () => Property.PropertyValueChanging += (s, e) => e.Disable());
     When("the property value changed handler is added", () => Property.PropertyValueChanged += (s, e) =>
     {
         OldPropertyValue = e.OldValue;
         NewPropertyValue = e.NewValue;
     });
     When("the value of the property is changed", () => Property.Value = "Changed");
     Then("the property changed event handler should not be called", () => OldPropertyValue == null && NewPropertyValue == null);
     Then("the value of the BoundProperty should not be changed", () => BoundProperty.Value == "Test");
 }
 void Ex03() => Expect("the value of the property should be the specified value", () => BoundProperty <string> .Of("Test").Value == "Test");
 void Ex01()
 {
     Given("a property whose value is null", () => Property = new ObservableProperty <string>());
     Given("a BoundProperty that binds a given property", () => BoundProperty = BoundProperty <string> .Of(null).Bind(Property));
     When("the property value changed handler is added", () => Property.PropertyValueChanged += (s, e) =>
     {
         OldPropertyValue = e.OldValue;
         NewPropertyValue = e.NewValue;
     });
     When("the value of the property is changed", () => Property.Value = "Changed");
     Then("the old value of the property value changed handler should be the previous value", () => OldPropertyValue == null);
     Then("the new value of the property value changed handler should be the changed value", () => NewPropertyValue == "Changed");
     Then("the value of the BoundProperty should be the changed value", () => BoundProperty.Value == "Changed");
 }
Esempio n. 4
0
 /// <summary>
 /// Converts the specified value to the bound property.
 /// </summary>
 /// <typeparam name="T">The type of the property value.</typeparam>
 /// <param name="target">The object that is converted to the bound property.</param>
 /// <returns>The instance of the <see cref="BoundProperty{T}"/> class.</returns>
 public static BoundProperty <T> ToBoundProperty <T>(this T target) => BoundProperty <T> .Of(target);
        public BoundPropertySpec_Binding_OneWayWithConverter()
        {
            Property1 = BoundProperty <string> .Of("Test1");

            Property2 = ObservableProperty <int> .Of(3);
        }
 public BoundProperty_Spec_Binding_MultiBinding()
 {
     Property = BoundProperty <string> .Of("Test1");
 }
 public BoundPropertySpec_Binding_OneWay()
 {
     Property1 = BoundProperty<string>.Of("Test1");
     Property2 = ObservableProperty<string>.Of("Test2");
 }