Beispiel #1
0
            public async Task SavePodcastForReview(PodcastDto dto)
            {
                var podcast = new DataLayer.Models.Podcast
                {
                    Title       = dto.Title,
                    Description = dto.Description,
                    ImageUrl    = dto.ImageUrl,
                    FeedUrl     = dto.FeedUrl,
                    SiteUrl     = dto.SiteUrl
                };

                _context.Podcasts.Add(podcast);
                await _context.SaveChangesAsync();
            }
        public async void AllThingsGit_ShouldReturnAlreadyInDatabaseResult()
        {
            var podcast = new DataLayer.Models.Podcast
            {
                Title      = "All Things Git",
                FeedUrl    = "https://www.allthingsgit.com/rss.xml",
                IsApproved = true
            };

            Context.Podcasts.Add(podcast);
            await Context.SaveChangesAsync();

            var command = new SubmitForReview.Command {
                RssFeedUrl = "https://www.allthingsgit.com/rss.xml"
            };

            var handler = new SubmitForReview.CommandHandler(Context, A.Fake <RssParser>(), A.Fake <PodcastEmailService>(), A.Fake <ILogger>());
            var result  = await handler.Handle(command);

            Assert.Equal(SuccessResult.AlreadyExists, result.SuccessResult);
        }