public void GetVideosByPublisher_ShouldntReturnVideosInOtherPublisher() { var publisherService = new PublisherService(); var publisher = publisherService.CreateAndRetrievePublisher(new CreatePublisherDto("", "", -1, "", testLibrary.LibraryId)); var otherPublisher = publisherService.CreateAndRetrievePublisher(new CreatePublisherDto("", "", -1, "", testLibrary.LibraryId)); repository.CreateVideo(GetNewVideoDetails(otherPublisher)); var videos = repository.GetVideosByPublisher(publisher.PublisherId, GetFirstPage()).Result.Results; CollectionAssert.AreEquivalent(new List <Video>(), videos); }
public void UpdateVideo_ChangingPublisherToNotNull_ShouldDeleteSeries() { var publisherService = new PublisherService(); var publisher = publisherService.CreateAndRetrievePublisher(new CreatePublisherDto("", "", -1, "", testLibrary.LibraryId)); var publisher2 = publisherService.CreateAndRetrievePublisher(new CreatePublisherDto("", "", -1, "", testLibrary.LibraryId)); var seriesService = new SeriesService(); var series = seriesService.CreateAndRetrieveSeries(GetNewSeriesDetails()); var videoDto = GetNewVideoDetails(testLibrary, publisher, series); var videoToUpdateId = repository.CreateVideo(videoDto); var videoToUpdate = repository.GetVideo(videoToUpdateId).Result; videoToUpdate.PublisherId = publisher2.PublisherId; videoToUpdate.SeriesId = DatabaseConstants.DEFAULT_ID; repository.UpdateVideo(videoToUpdate).ConfigureAwait(false); var updatedVideo = repository.GetVideo(videoToUpdateId).Result; Assert.AreEqual(publisher2.PublisherId, updatedVideo.PublisherId); Assert.AreEqual(DatabaseConstants.DEFAULT_ID, updatedVideo.SeriesId); }
public void ShouldDeleteLocation_WhenPublisherDeleted() { var publisherService = new PublisherService(); var publisher = publisherService.CreateAndRetrievePublisher(new CreatePublisherDto("", "", -1, "", testLibrary.LibraryId)); var locationId = CreateNewLocation(testLibrary, publisher); publisherService.DeletePublisher(publisher).ConfigureAwait(false); var locationRetrieved = repository.GetLocation(locationId); CollectionAssert.AreEquivalent(new List <Location>() { locationRetrieved }, repository.GetDeletedLocations(GetFirstPage()).Result.Results); CollectionAssert.AreEquivalent(new List <Location>(), repository.GetLocations(GetFirstPage()).Result.Results); }
public void ShouldDeleteVideo_WhenPublisherDeleted() { var publisherService = new PublisherService(); var publisher = publisherService.CreateAndRetrievePublisher(new CreatePublisherDto("", "", -1, "", testLibrary.LibraryId)); var videoToCreate = GetNewVideoDetails(publisher); var videoId = repository.CreateVideo(videoToCreate); publisherService.DeletePublisher(publisher).ConfigureAwait(false); var videoRetrieved = repository.GetVideo(videoId).Result; CollectionAssert.AreEquivalent(new List <Video>() { videoRetrieved }, repository.GetDeletedVideos(GetFirstPage()).Result.Results); CollectionAssert.AreEquivalent(new List <Video>(), repository.GetVideos(GetFirstPage()).Result.Results); }
public void GetVideosByPublisher_ShouldntReturnDeletedVideos() { var publisherService = new PublisherService(); var publisher = publisherService.CreateAndRetrievePublisher(new CreatePublisherDto("", "", -1, "", testLibrary.LibraryId)); var expectedVideos = new List <Video>(); for (int i = 0; i < 3; ++i) { var video = CreateAndRetrieveVideo(GetNewVideoDetails(publisher)); expectedVideos.Add(video); } var deletedVideo = CreateAndRetrieveVideo(GetNewVideoDetails(publisher)); repository.DeleteVideo(deletedVideo.VideoId).ConfigureAwait(false); var videos = repository.GetVideosByPublisher(publisher.PublisherId, GetFirstPage()).Result.Results; CollectionAssert.AreEquivalent(expectedVideos, videos); }