public void AddCalendars_ValidListOfCalendars_Added()
        {
            //Arrange
            var cals    = new CalendarBuilder().BuildList();
            var service = this.kernel.Get <WebCalendar.Services.CalendarService>();

            //Act
            service.AddCalendars(cals);
            //Assert
            VerifyAddListOfCalendars(Times.Exactly(cals.Count));
        }
        public void Create_ValidCalendar_Created()
        {
            //Arrange
            var newCalendar = new CalendarBuilder().Build();
            var service     = this.kernel.Get <WebCalendar.Services.CalendarService>();

            //Act
            service.Create(newCalendar);
            //Assert
            VerifyCreateCalendar(Times.Once());
        }
        public void Get_ValidCalendar_ReturnCalendar()
        {
            //Arrange
            Calendar expected = new CalendarBuilder().Build();

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

            //Assert
            Assert.IsNotNull(actual);
            Assert.AreEqual(expected, actual);
        }
        public void GetCalendars_ValidEntities_ReturnListOfCalendars()
        {
            //Arrange
            var expected = new CalendarBuilder().WithUserID(USER_ID);

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

            //Assert
            Assert.IsNotNull(actual);
            Assert.IsTrue(actual.Count == 1);
            Assert.AreEqual(expected, actual[0]);
        }
        public void Update_ValidCalendar_Updated()
        {
            //Arrange
            var cal = new CalendarBuilder().WithUserID(USER_ID);

            SetUpRepository(cal);
            var service = this.kernel.Get <WebCalendar.Services.CalendarService>();

            //Act
            cal.Title = UPDATED_TITLE;
            service.Update(cal);
            var actual = service.Get(CALENDAR_ID);

            //Assert
            Assert.AreEqual(UPDATED_TITLE, actual.Title);
            Assert.AreEqual(cal, actual);
        }
        public void Update_ConversionExceptionForCalendar_ExceptionThrown()
        {
            //Arrange
            Exception exception = null;
            Calendar  cal       = new CalendarBuilder().Build();

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

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