public void TestUpdateSeries()
        {
            var calendarRepository = new CalendarRepository();
            var calendarId         = calendarRepository.CreateCalendar(new CreateCalendarDto("MM-DD-YYYY", "", "", testLibrary.LibraryId));

            var seriesToCreate = new CreateSeriesDto("Test library", "https://ingvilt.test.url", -1, "test desc", -1, testLibrary.LibraryId, calendarId);
            var seriesId       = repository.CreateSeries(seriesToCreate);

            var seriesRetrieved = repository.GetSeries(seriesId).Result;
            var fileId          = mediaFileRepository.CreateMediaFile(new CreateMediaFileDto("C:/test.jpg", MediaFileType.IMAGE_TYPE, "test"));

            seriesRetrieved.Description += "1";
            seriesRetrieved.Name        += "2";
            seriesRetrieved.SiteURL      = "https://ingvilt.test2.url";
            seriesRetrieved.LogoFileId   = fileId;
            repository.UpdateSeries(seriesRetrieved);

            var updatedSeriesRetrieved = repository.GetSeries(seriesId).Result;

            Assert.AreEqual(seriesRetrieved.SeriesId, updatedSeriesRetrieved.SeriesId);
            Assert.AreEqual(seriesRetrieved.Name, updatedSeriesRetrieved.Name);
            Assert.AreEqual(seriesRetrieved.Description, updatedSeriesRetrieved.Description);
            Assert.AreEqual(seriesRetrieved.LibraryId, updatedSeriesRetrieved.LibraryId);
            Assert.AreEqual(seriesRetrieved.LogoFileId, updatedSeriesRetrieved.LogoFileId);
            Assert.AreEqual(seriesRetrieved.SiteURL, updatedSeriesRetrieved.SiteURL);
            Assert.AreEqual(seriesRetrieved.CalendarId, updatedSeriesRetrieved.CalendarId);
            CollectionAssert.AreEquivalent(new List <Series>()
            {
                updatedSeriesRetrieved
            }, repository.GetSeries(GetFirstPage()).Result.Results);
        }
        public void TestCreateSeries_WithCalendar()
        {
            var calendarRepository = new CalendarRepository();
            var calendarId         = calendarRepository.CreateCalendar(new CreateCalendarDto("MM-DD-YYYY", "", "", testLibrary.LibraryId));
            var seriesToCreate     = new CreateSeriesDto("Test library", "https://ingvilt.test.url", -1, "test desc", -1, testLibrary.LibraryId, calendarId);
            var seriesId           = repository.CreateSeries(seriesToCreate);

            var seriesRetrieved = repository.GetSeries(seriesId).Result;

            Assert.AreEqual(seriesId, seriesRetrieved.SeriesId);
            Assert.AreEqual(seriesToCreate.Name, seriesRetrieved.Name);
            Assert.AreEqual(seriesToCreate.Description, seriesRetrieved.Description);
            Assert.AreEqual(seriesToCreate.LibraryId, seriesRetrieved.LibraryId);
            Assert.AreEqual(seriesToCreate.LogoFileId, seriesRetrieved.LogoFileId);
            Assert.AreEqual(seriesToCreate.SiteURL, seriesRetrieved.SiteURL);
            Assert.AreEqual(seriesToCreate.CalendarId, seriesRetrieved.CalendarId);
            Assert.AreNotEqual(DatabaseConstants.DEFAULT_ID, seriesRetrieved.CalendarId);
        }
Beispiel #3
0
        public HomeController()
        {
            IPrincipal user = new GenericPrincipal(new GenericIdentity("User 1"), new[] { "student" });

            var e = new Event
            {
                Created     = DateTime.Now,
                Start       = DateTime.Now,
                End         = DateTime.Now.AddDays(1),
                Description = "Test",
                Location    = "sdfsdf"
            };


            ICalendarRepository repository = new CalendarRepository(user);
            var calendar = repository.CreateCalendar("me");

            //calendar.ID = "student-calendar";
            (calendar as CalendarInfo).AddItem(e);
            repository.Save(calendar, e);

            RegisterService(repository);
        }
        private Calendar CreateAndRetrieveCalendar(CreateCalendarDto dto)
        {
            var id = repository.CreateCalendar(dto);

            return(repository.GetCalendar(id));
        }
Beispiel #5
0
 public long CreateCalendar(CreateCalendarDto dto)
 {
     return(calendarRepository.CreateCalendar(dto));
 }