public void ShouldOmitDelegateWithTransientTarget() { var withEvent = new ClassWithEvent(); var target1 = new TransientClassWithMethod(); var target2 = new CompanionToClassWithEvent(); withEvent.Event += target2.Method; withEvent.Event += target1.Method; var copy = SerializerClone(withEvent); copy.Invoke(); }
public void ShouldSerializeEvent() { var withEvent = new ClassWithEvent(); var companion = new CompanionToClassWithEvent(); withEvent.Event += companion.Method; var pair = Tuple.Create(withEvent, companion); var copy = SerializerClone(pair); copy.Item1.Invoke(); Assert.AreEqual(1, copy.Item2.Counter); }
public void ShouldSerializeMulticastEvent() { var withEvent = new ClassWithEvent(); var companion1 = new CompanionToClassWithEvent(); withEvent.Event += companion1.Method; var companion2 = new CompanionToClassWithEvent(); withEvent.Event += companion2.Method; var triple = Tuple.Create(withEvent, companion1, companion2); var copy = SerializerClone(triple); copy.Item1.Invoke(); Assert.AreEqual(1, copy.Item2.Counter); Assert.AreEqual(1, copy.Item3.Counter); }