public void CreateChildBindable() { var a = new Bindable <int>(2, 1) { IsBindable = false }; var b = a.CreateChildBindable(); Assert.AreEqual(a.Value, b.Value); Assert.AreEqual(a.DefaultValue, b.DefaultValue); Assert.IsFalse(a.IsBoundTo(b)); Assert.IsTrue(b.IsBoundTo(a)); Assert.IsFalse(a.IsBindable); Assert.IsTrue(b.IsBindable); }
public void CopyWithAllowedBindability() { var a = new Bindable <int>(2, 1) { IsBindable = false }; var b = a.CopyWithAllowedBindability(); Assert.AreEqual(a.Value, b.Value); Assert.AreEqual(a.DefaultValue, b.DefaultValue); Assert.IsFalse(a.IsBoundTo(b)); Assert.IsFalse(b.IsBoundTo(a)); Assert.IsFalse(a.IsBindable); Assert.IsTrue(b.IsBindable); }
public void CreateNewBindableBoundToThis() { var a = new Bindable <int>(2, 1) { IsBindable = false }; var b = a.CreateNewBindableBoundToThis(); // default(int) is necessary because the Assert class does not force object type equality Assert.AreEqual(default(int), b.Value); Assert.AreEqual(default(int), b.DefaultValue); Assert.IsFalse(a.IsBoundTo(b)); Assert.IsTrue(b.IsBoundTo(a)); Assert.IsFalse(a.IsBindable); Assert.IsTrue(b.IsBindable); }
public void CopyBindableAndBindToThis() { AssertBindables(true); AssertBindables(false); void AssertBindables(bool isBindable) { var a = new Bindable <int>(2, 1) { IsBindable = isBindable }; var b = a.CopyBindableAndBindToThis(); Assert.AreEqual(a.Value, b.Value); Assert.AreEqual(a.DefaultValue, b.DefaultValue); Assert.IsFalse(a.IsBoundTo(b)); Assert.AreEqual(isBindable, b.IsBoundTo(a)); Assert.AreEqual(a.IsBindable, b.IsBindable); } }