public bool RefreshEpisodesForSubscription([FromBody] int subscriptionId) { var command = new RefreshEpisodesCommand { SubscriptionId = subscriptionId }; _commandSender.Send(command); return(true); }
public void Should_refresh_episodes_for_show() { var lastAirDate = DateTime.Now; _updateEpisodesService.UpdateEpisodesForSubscription(Arg.Any <Subscription>()).Returns(lastAirDate); _subscriptionQueryDataSource.GetSubscription(1).Returns(_subscription); var command = new RefreshEpisodesCommand { SubscriptionId = 1 }; _handler.Handle(command); _episodeCommandDataSource.Received(1).DeleteAllFromSubscription(_subscription.Id); _updateEpisodesService.Received(1).UpdateEpisodesForSubscription(Arg.Is <Subscription>(s => s.Id == _subscription.Id && s.TvShowId == _subscription.TvShowId && s.TvShowName == _subscription.TvShowName && s.LastAirDate == DateTime.Now.Date)); _subscriptionCommandDataSource.Received(1).SaveLastAirDate(_subscription.Id, lastAirDate.Date); }