public void ConnectingChangesValue() { var connectableProperty = new ConnectableProperty <int>(0); connectableProperty.Connect(parent); connectableProperty.Value.Should().Be(1); }
public void ParentValueChangesTriggerValueChangeInConnectableProperty() { var connectableProperty = new ConnectableProperty <int>(0); connectableProperty.Connect(parent); parent.Value = 2; connectableProperty.Value.Should().Be(2); }
private void connectableProperty() { var connectable = new ConnectableProperty <int>(0); var a = new StoredProperty <int>(8); Console.WriteLine(connectable.Value); // 0 connectable.Connect(a); Console.WriteLine(connectable.Value); // 8 }
public void DisconnectingResetsValueToDisconnectedValue() { var connectableProperty = new ConnectableProperty <int>(0); connectableProperty.Connect(parent); connectableProperty.Value.Should().Be(1, "before disconnecting"); connectableProperty.Disconnect(); connectableProperty.Value.Should().Be(0, "after disconnecting"); }
public void ConnectingWithSameValueDoesNotFireChange() { bool eventFired = false; var connectableProperty = new ConnectableProperty <int>(0); connectableProperty.PropertyChanged += delegate { eventFired = true; }; connectableProperty.Connect(new StoredProperty <int>(0)); eventFired.Should().BeFalse(); }
public void ConnectingWithDifferentValueFiresChange() { bool eventFired = false; var connectableProperty = new ConnectableProperty <int>(0); connectableProperty.PropertyChanged += delegate { eventFired = true; }; connectableProperty.Connect(parent); eventFired.Should().BeTrue(); }
public void DisconnectingWithSameValueResetsValueToDisconnectedValue() { var connectableProperty = new ConnectableProperty <int>(0); connectableProperty.Connect(new StoredProperty <int>(0)); connectableProperty.Value.Should().Be(0, "before disconnecting"); connectableProperty.Disconnect(); connectableProperty.Value.Should().Be(0, "after disconnecting"); }
public void DisconnectingFiresChange() { bool eventFired = false; var connectableProperty = new ConnectableProperty <int>(0); connectableProperty.Connect(parent); connectableProperty.PropertyChanged += delegate { eventFired = true; }; eventFired.Should().BeFalse("have not disconnected yet"); connectableProperty.Disconnect(); eventFired.Should().BeTrue("disconnected"); }
public void ParentValueChangesTriggerChangeEventsInConnectableProperty() { bool eventFired = false; var connectableProperty = new ConnectableProperty <int>(0); connectableProperty.Connect(parent); connectableProperty.PropertyChanged += delegate { eventFired = true; }; eventFired.Should().BeFalse("haven't changed the parent property yet"); parent.Value = 2; eventFired.Should().BeTrue("parent event changed"); }
public void DisconnectingWithSameValueDoesNotFireChange() { bool eventFired = false; var connectableProperty = new ConnectableProperty <int>(0); connectableProperty.Connect(new StoredProperty <int>(0)); connectableProperty.PropertyChanged += delegate { eventFired = true; }; eventFired.Should().BeFalse("have not disconnected yet"); connectableProperty.Disconnect(); eventFired.Should().BeFalse("disconnected, but the value should not have changed from 0 to 0"); }
public void InitialValue() { var connectableProperty = new ConnectableProperty <int>(0); connectableProperty.Value.Should().Be(0, "before connecting"); }
set => SetValue(ConnectableProperty, value);