public void DoChangedPropertyPasses() { var target = new LayoutClass(); Assert.IsFalse(target.DoChanged); target.SetDoChanged(true); Assert.IsTrue(target.DoChanged); target.SetDoChanged(target.DoChanged); Assert.IsTrue(target.DoChanged); target.SetDoChanged(false); Assert.IsFalse(target.DoChanged); }
public void TargetPropertyPasses() { var target = new LayoutClass(); Assert.IsNull(target.Target); var obj = new LayoutTargetObject(); Assert.AreEqual(0, obj.OnDisposed.RegistedDelegateCount); { target.Target = obj; // test point Assert.AreSame(obj, target.Target); Assert.IsTrue(target.DoChanged); Assert.AreEqual(1, obj.OnDisposed.RegistedDelegateCount); Assert.AreEqual(1, target.CallCounterOnChanged); } { target.SetDoChanged(false); target.CallCounterOnChanged = 0; target.Target = null; // test point Assert.IsNull(target.Target); Assert.IsTrue(target.DoChanged); Assert.AreEqual(0, obj.OnDisposed.RegistedDelegateCount); Assert.AreEqual(1, target.CallCounterOnChanged); } }
public void InnerOnChangedPasses() { var target = new LayoutClass(); Assert.IsFalse(target.DoChanged); target.SetDoChanged(true); Assert.AreEqual(1, target.CallCounterOnChanged); Assert.AreEqual(target.DoChanged, target.DoChangedOnChanged); }
public void OnChangedWhenThrowExceptionPasses() { var target = new LayoutClass(); Assert.IsFalse(target.DoChanged); target.OnChanged.Add((_self, _do) => { throw new System.Exception(); }); target.SetDoChanged(true); Assert.IsTrue(target.DoChanged); }
public void OnChangedPasses() { var target = new LayoutClass(); Assert.IsFalse(target.DoChanged); var callCounter = 0; (ILayout self, bool doChanged)recievedValue = default; target.OnChanged.Add((_self, _do) => { callCounter++; recievedValue = (_self, _do); }); target.SetDoChanged(true); Assert.AreEqual(1, callCounter); Assert.AreSame(target, recievedValue.self); Assert.IsTrue(recievedValue.doChanged); }