public async Task Given2PodcastsExist() { var podcastFileRepository = new PodcastFileRepository(); Podcast podcast1 = Podcast.Create("http://www.dr.dk/mu/Feed/harddisken?format=podcast&limit=500"); Podcast podcast2 = Podcast.Create("http://www.dr.dk/mu/Feed/troldspejlet?format=podcast&limit=500"); await podcastFileRepository.Add(podcast1); await podcastFileRepository.Add(podcast2); }
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>(); } }
public async Task GivenPodcastsExist(Podcast podcast) { var podcastFileRepository = new PodcastFileRepository(); await podcastFileRepository.Add(podcast); }