コード例 #1
0
        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);
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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>();
            }
        }
コード例 #4
0
 public async Task GivenPodcastsExist(Podcast podcast)
 {
     var podcastFileRepository = new PodcastFileRepository();
     await podcastFileRepository.Add(podcast);
 }