public void FromWithEventUnregistration() { var mapper = NotificationMapper <IMockNotificationSet> .Create(); mapper.From(s => s.OnMyEvent -= null) .GenerateHandler(); var map = mapper.ToMap(); Assert.AreEqual(1, map.Definitions.Length); var def = map.Definitions[0]; var id = NotificationId.Create(typeof(IMockNotificationSet).GetEvent("OnMyEvent")); Assert.AreEqual(id, def.Id); }
public void ToMapWithMissingRegistration() { var mapper = NotificationMapper <IMockNotificationSet> .Create(); Assert.Throws <NotificationEventNotMappedException>(() => mapper.ToMap()); }
public void FromWithNonEventAction() { var mapper = NotificationMapper <IMockNotificationSet> .Create(); Assert.Throws <InvalidNotificationMethodExpressionException>(() => mapper.From(s => s.GetType())); }