public async void ReturnJediEpisodeGivenIdOf6() { // When var jedi = await _episodeRepository.Get(6); // Then Assert.NotNull(jedi); Assert.Equal("JEDI", jedi.Title); }
public async void ReturnEpisodeGivenId() { var episode = await _episodeRepository.Get(6); Assert.NotNull(episode); Assert.Equal("JEDI", episode.Title); }
public static Episode Get(int id) { if (id <= 0) { throw new MediaManagerException($"Erreur : {nameof(id)} <= 0", ExceptionReturnType.Error); } try { Episode result; using (var context = new MediaManagerContext()) using (var repository = new EpisodeRepository(context)) { result = repository.Get(id); } return(result); } catch (Exception ex) { throw new MediaManagerException($"Erreur : {ex.Message}", ExceptionReturnType.Error); } }