public void ShouldInvokeDynamicMethod() { // Given Guid expected = Guid.NewGuid(); dynamic element = new SomePrototype(); element.DynamicMethod = new Func <object>(() => expected); // When dynamic actual = element.DynamicMethod(); // Then Assert.AreEqual(expected, actual); }
public void ShouldAddDynamicMethodWhenSubscribe() { // Given Guid expected = Guid.NewGuid(); dynamic element = new SomePrototype(); Func <object> subscription = () => expected; // When element.DynamicMethod += subscription; dynamic actual = element.DynamicMethod(); // Then Assert.AreEqual(expected, actual); }