Ejemplo n.º 1
0
        public void SendNotificationsTest_NotificationGetsSent_ResultIsTrue()
        {
            _notificationReceiverMock.SendNotification = true;

            _sendNotifications = new SendNotifications(new[] { _notificationReceiverMock }, false, false, _updatePackageMock, _nowGetterMock, _blackboardMock.Object);

            var actual = _sendNotifications.Do();
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Errors.Count() == 0);
            Assert.AreEqual(1, _notificationReceiverMock.SendNotificationCalled);
            Assert.IsTrue(actual.Successful);
        }
Ejemplo n.º 2
0
        public void SendNotificationsTest_NotificationSentFails_ResultIsFalse_ErrorIsReturned()
        {
            _notificationReceiverMock.SendNotification = false;
            var exceptionToThrow = new NotificationSentException("Fehler");
            _notificationReceiverMock.SendNotificationThrowThisException = exceptionToThrow;

            _sendNotifications = new SendNotifications(new[] { _notificationReceiverMock }, false, false, _updatePackageMock, _nowGetterMock, _blackboardMock.Object);

            var actual = _sendNotifications.Do();
            Assert.IsNotNull(actual);
            Assert.AreEqual(1, actual.Errors.Count());
            Assert.AreEqual(actual.Errors.First().Exception, exceptionToThrow);
            Assert.AreEqual(1, _notificationReceiverMock.SendNotificationCalled);
            Assert.IsFalse(actual.Successful);
        }