Esempio n. 1
0
        public async Task ShouldSendOrderedNotificationsForArticlesWithGreaterDate()
        {
            IEnumerable <Article> received = null;

            _notificationService
            .When(x => x.SendNotifications(Arg.Any <IEnumerable <Article> >()))
            .Do(callback => received = callback.Arg <IEnumerable <Article> >());

            _settingManager.Read().Returns(new Settings {
                Fetched = DateTime.MinValue
            });
            _feedStoreService.Load(Arg.Any <IEnumerable <Channel> >()).Returns(new List <Article>
            {
                new Article {
                    Title = "Foo", PublishedDate = DateTime.Now
                },
                new Article {
                    Title = "Bar", PublishedDate = DateTime.MaxValue
                }
            });

            await _backgroundService.CheckForUpdates(DateTime.Now);

            var response = new List <Article>(received);

            response.First().Title.Should().Be("Foo");
            response.Last().Title.Should().Be("Bar");
            response.Count.Should().Be(2);
        }