Пример #1
0
        public async Task ShouldSaveShowToStorage()
        {
            // Arrange

            // Act
            await _showProvider.SaveShows(new []
            {
                new BusinessLayer.Providers.ShowProvider.Entities.Show
                {
                    Name   = "Name",
                    People = new BusinessLayer.Providers.ShowProvider.Entities.Person[0]
                }
            });

            // Assert
            _showStorageMock
            .Verify(x => x.AddShows(It.IsAny <ICollection <DataLayer.Domains.Show> >()), Times.Once);
        }
        public async Task GrabData(string grabberName = "tvMaze", int fromPage = 0, int?toPage = null)
        {
            if (fromPage < 0)
            {
                throw new ArgumentException(nameof(fromPage));
            }

            if (toPage == null)
            {
                toPage = fromPage + 1;
            }
            else if (toPage <= fromPage)
            {
                throw new ArgumentException(nameof(toPage));
            }

            var grabber = _showGrabberFactory.CreateGrabber(grabberName);

            var newShows = await grabber.Grab(fromPage, toPage.Value);

            await _showProvider.SaveShows(newShows);
        }