public void MediaRepository_GetByUserName_ThrowsExceptionWhenUserNameNotFound() { //arrange IMediaRepo mediaRepo = GetInMemoryMediaRepository(); //act mediaRepo.Add(media); //assert Assert.ThrowsAny <ArgumentNullException>(() => mediaRepo.GetByTitle("NotExistingTitle")); }
public void MediaRepository_GetById_ThrowsExceptionWhenIdNotFound() { //arrange IMediaRepo mediaRepo = GetInMemoryMediaRepository(); //act mediaRepo.Add(media); //assert Assert.ThrowsAny <ArgumentNullException>(() => mediaRepo.GetById(2)); }
public void MediaRepository_Update_ThrowsExceptionWhenUserIdNotFound() { //arrange IMediaRepo mediaRepo = GetInMemoryMediaRepository(); //act mediaRepo.Add(media); Media saveMedia = mediaRepo.GetByTitle(media.MediaName); saveMedia.MediaId = 0; //assert Assert.ThrowsAny <ArgumentNullException>(() => mediaRepo.Update(saveMedia)); }
public void MediaRepository_Update_UpdatesMedia() { //arrange IMediaRepo mediaRepo = GetInMemoryMediaRepository(); //act mediaRepo.Add(media); Media saveMedia = mediaRepo.GetByTitle(media.MediaName); saveMedia.Composer = "update composer"; mediaRepo.Update(saveMedia); Media updateMedia = mediaRepo.GetByTitle(media.MediaName); //assert Assert.Equal("update composer", updateMedia.Composer); }
public void MediaRepository_GetById_GetsMedia() { //arrange IMediaRepo mediaRepo = GetInMemoryMediaRepository(); //act mediaRepo.Add(media); Media saveMedia = mediaRepo.GetById(1); //Assert Assert.Equal(1, saveMedia.MediaId); Assert.Equal("test media name", saveMedia.MediaName); Assert.Equal("test composer", saveMedia.Composer); Assert.Equal("hello, this is a test description", saveMedia.Description); Assert.Equal(9, saveMedia.Rating); Assert.Equal("https://upload.wikimedia.org/wikipedia/en/8/8a/The_Avengers_%282012_film%29_poster.jpg", saveMedia.MediaUrl); Assert.True(saveMedia.Approved); }
public MediaController(IMapper mapper, IMediaRepo mediaRepo, IRatingCalculatorCoordinator ratingCoordinator = null) { _mediaRepo = mediaRepo; _mapper = mapper; _ratingCoordinator = ratingCoordinator; }
public RatingCalculatorCoordinator(IMapper mapper, IJournalistRepo journalistRepo, IMediaRepo mediaRepo) { _mapper = mapper; _journalistRepo = journalistRepo; _mediaRepo = mediaRepo; }
public MediaManager(IMediaRepo _mediaRepo) { mediaRepo = _mediaRepo; }
public MediaController(IMediaRepo mediaRepository, IMediaTypeRepo mediaTypeRepo, IGenreRepo genreRepo) { _mediaRepository = mediaRepository; _mediaTypeRepository = mediaTypeRepo; _genreRepository = genreRepo; }