public void TestBindableWithCurrentReceivesBoundValue() { const string expected_value = "test"; var bindable = new Bindable <string>(expected_value); var bindableWithCurrent = new BindableWithCurrent <string> { Current = bindable }; Assert.That(bindable.Value, Is.EqualTo(expected_value)); Assert.That(bindableWithCurrent.Value, Is.EqualTo(expected_value)); }
public void TestBindableWithCurrentReceivesValueChanges() { const string expected_value = "test2"; var bindable = new Bindable <string>(); var bindableWithCurrent = new BindableWithCurrent <string> { Current = bindable }; bindable.Value = expected_value; Assert.That(bindableWithCurrent.Value, Is.EqualTo(expected_value)); }
public void TestChangeCurrentBindsToNewBindable() { const string expected_value = "test3"; var bindable1 = new Bindable <string>(); var bindable2 = new Bindable <string>(); var bindableWithCurrent = new BindableWithCurrent <string> { Current = bindable1 }; bindableWithCurrent.Current = bindable2; bindableWithCurrent.Value = "test3"; Assert.That(bindable1.Value, Is.Not.EqualTo(expected_value)); Assert.That(bindable2.Value, Is.EqualTo(expected_value)); }
public void TestChangeCurrentDoesNotUnbindOthers() { const string expected_value = "test2"; var bindable1 = new Bindable <string>(); var bindable2 = bindable1.GetBoundCopy(); var bindableWithCurrent = new BindableWithCurrent <string> { Current = bindable1 }; bindableWithCurrent.Current = new Bindable <string>(); bindable1.Value = expected_value; Assert.That(bindable2.Value, Is.EqualTo(expected_value)); Assert.That(bindableWithCurrent.Value, Is.Not.EqualTo(expected_value)); }