public void Should_return_list_of_episodes()
        {
            _episodesQueryDataSource.GetToDate(_episodesToDate).Returns(CreateEpisodesList());
            _subscriptionQueryDataSource.GetAllSubscriptions().Returns(CreateSubscriptionList());

            var result = _handler.Handle(_query);

            Assert.NotNull(result);
            Assert.NotNull(result.Episodes);
            Assert.Equal(4, result.Episodes.Count());
        }
Exemplo n.º 2
0
        public EpisodesToDateResult Handle(EpisodesToDateQuery query)
        {
            var shows    = _subscriptionQueryDataSource.GetAllSubscriptions();
            var episodes = _episodesQueryDataSource.GetToDate(query.ToDate);

            return(new EpisodesToDateResult
            {
                Episodes = episodes.Select(e => new EpisodeWithSubscriptionInfoDto
                {
                    Episode = e,
                    Subscription = shows.First(id => id.Id == e.SubscriptionId)
                })
            });
        }