コード例 #1
0
        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);
        }
コード例 #2
0
        public void ToMapWithMissingRegistration()
        {
            var mapper = NotificationMapper <IMockNotificationSet> .Create();

            Assert.Throws <NotificationEventNotMappedException>(() => mapper.ToMap());
        }
コード例 #3
0
        public void FromWithNonEventAction()
        {
            var mapper = NotificationMapper <IMockNotificationSet> .Create();

            Assert.Throws <InvalidNotificationMethodExpressionException>(() => mapper.From(s => s.GetType()));
        }