public void AddNotifications_ValidListOfNotifications_Added()
        {
            //Arrange
            var notifies = new NotificationBuilder().BuildList();
            var service  = this.kernel.Get <WebCalendar.Services.NotificationService>();

            //Act
            service.AddNotifications(notifies);
            //Assert
            VerifyAddListOfNotifications(Times.Exactly(notifies.Count));
        }
        public void Create_ValidNotification_Created()
        {
            //Arrange
            var newNotify = new NotificationBuilder().Build();
            var service   = this.kernel.Get <WebCalendar.Services.NotificationService>();

            //Act
            service.Create(newNotify);
            //Assert
            VerifyCreateNotification(Times.Once());
        }
        public void Get_ValidNotification_ReturnNotification()
        {
            //Arrange
            Notification expected = new NotificationBuilder().Build();

            SetUpRepository(expected);
            var service = this.kernel.Get <WebCalendar.Services.NotificationService>();
            //Act
            var actual = service.Get(NOTIFICATION_ID);

            //Assert
            Assert.IsNotNull(actual);
            Assert.AreEqual(expected, actual);
        }
        public void GetNotificationFromEvent()
        {
            //Arrange
            var expected = new NotificationBuilder().Build();

            SetUpRepository(expected);
            SetUpEventRepository();

            var service = this.kernel.Get <WebCalendar.Services.NotificationService>();
            //Act
            var actual = service.GetNotificationFromEvent(EVENT_ID);

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void GetNotifications_ValidEntities_ReturnListOfNotifications()
        {
            //Arrange
            var expected = new NotificationBuilder().Build();

            SetUpRepository(expected);
            var service = this.kernel.Get <WebCalendar.Services.NotificationService>();
            //Act
            var actual = service.GetNotifications;

            //Assert
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Count == 1);
            Assert.AreEqual(expected, actual[0]);
        }
        public void Update_ValidNotification_Updated()
        {
            //Arrange
            var notify = new NotificationBuilder().Build();

            SetUpRepository(notify);
            var service = this.kernel.Get <WebCalendar.Services.NotificationService>();

            //Act
            notify.Type = UPDATED_TYPE;
            service.Update(notify);
            var actual = service.Get(NOTIFICATION_ID);

            //Assert
            Assert.AreEqual(UPDATED_TYPE, actual.Type);
            Assert.AreEqual(notify, actual);
        }
        public void Update_ConversionExceptionForNotification_ExceptionThrown()
        {
            //Arrange
            Exception    exception = null;
            Notification notify    = new NotificationBuilder().Build();

            SetUpRepository();
            SetUpArgumentNullException();
            var service = this.kernel.Get <WebCalendar.Services.NotificationService>();

            //Act
            try
            {
                service.Update(notify);
            }
            catch (ConversionException ex) { exception = ex; }
            //Assert
            VerifyExceptionThrown(exception, ExpectedExceptionMessages.NOTIFICATION_NOT_FOUND);
        }