public void ShouldSerializeDelegateWithTargetFromDifferentModule() { var withEvent = new ClassWithEvent(); var companion = new CompanionSecondModule(); withEvent.Event += companion.MethodAsExtension; var pair = Tuple.Create(withEvent, companion); var copy = SerializerClone(pair); copy.Item1.Invoke(); Assert.AreEqual(1, copy.Item2.Counter); }
public static void MethodAsExtension(this CompanionSecondModule companion) { companion.Counter++; }