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); }