Ejemplo n.º 1
0
        public void TestNotify_ApplicationNotRegistered_ReturnsErrorLogsFailure()
        {
            var service         = new FoghornService();
            var notificationDto = new NotificationDto
            {
                NotificationMessage  = "This is the message of the test notification.",
                NotificationTypeName = NotificationName + "1",
                NotificationTitle    = "Notification Title"
            };

            Assert.Throws <ArgumentException>(delegate { service.Notify(notificationDto, "IncorrectApplication"); });
        }
Ejemplo n.º 2
0
        public void TestNotify_SetUpConfigurationAndCallNotify_NotificationSentAndLogged()
        {
            TestRegisterSubscription_ApplicationExists_SubscriberRegistered();
            var service         = new FoghornService();
            var notificationDto = new NotificationDto
            {
                NotificationMessage  = "This is the message of the test notification.",
                NotificationTypeName = NotificationName + "1",
                NotificationTitle    = "Notification Title",
                Sticky   = true,
                Priority = 2
            };
            var notificationDtoReturned = service.Notify(notificationDto, ApplicationTestName);
            var notificationId          = notificationDtoReturned.NotificationId;
            var dataContext             = new FoghornEntities();
            var checkNotification       = dataContext.Notifications.FirstOrDefault(x => x.NotificationId == notificationId);

            Assert.NotNull(checkNotification);
        }