public async Task ShouldAddPodcast() { using (var context = new Context <PodcastFileRepository>()) { // Given Podcast podcast = Podcast.Create("http://www.dr.dk/mu/Feed/harddisken?format=podcast&limit=500"); var sut = context.CreateSut(); // When await sut.Add(podcast); // Then var podcastFileRepository = new PodcastFileRepository(); Podcast podcastFromRepository = podcastFileRepository.Get(podcast.Id); podcastFromRepository.ShouldBeEquivalentTo(podcast); podcastFromRepository.Should().NotBeSameAs(podcast); } }
public async Task ShouldDeletePodcast() { using (var context = new Context <PodcastFileRepository>()) { // Given Podcast podcast = Podcast.Create("http://www.dr.dk/mu/Feed/harddisken?format=podcast&limit=500"); await context.GivenPodcastsExist(podcast); var sut = context.CreateSut(); // When await sut.Delete(podcast.Id); // Then var podcastFileRepository = new PodcastFileRepository(); Action action = () => podcastFileRepository.Get(podcast.Id); action.ShouldThrow <InvalidOperationException>(); } }