Beispiel #1
0
        public async Task ItShouldReturnTrueWhenThereAreNewShows()
        {
            // Arrange
            PrepareRemoteShowRepositoryToReturnShows();
            var grabPageOfShowsScenario = new GrabPageOfShowsScenario(grabShowScenarioMock.Object, remoteShowRepositoryMock.Object);

            // Act
            var actualResult = await grabPageOfShowsScenario.RunAsync(1, new CancellationToken());

            // Accert
            Assert.True(actualResult);
        }
Beispiel #2
0
        public async Task ItShouldAddNewShows()
        {
            // Arrange
            var showIds = PrepareRemoteShowRepositoryToReturnShows();
            var grabPageOfShowsScenario = new GrabPageOfShowsScenario(grabShowScenarioMock.Object, remoteShowRepositoryMock.Object);

            // Act
            await grabPageOfShowsScenario.RunAsync(1, new CancellationToken());

            // Accert
            grabShowScenarioMock.Verify(x => x.RunAsync(It.IsAny <long>()), Times.Exactly(showIds.Count()));
        }
Beispiel #3
0
        public async Task ItShouldReturnFalseWhenNoNewShows()
        {
            // Arrange
            remoteShowRepositoryMock
            .Setup(x => x.GetPaginatedShowsAsync(It.IsAny <long>()))
            .Returns(Task.FromResult(Enumerable.Empty <Show>()));
            var grabPageOfShowsScenario = new GrabPageOfShowsScenario(grabShowScenarioMock.Object, remoteShowRepositoryMock.Object);

            // Act
            var actualResult = await grabPageOfShowsScenario.RunAsync(1, new CancellationToken());

            // Accert
            Assert.False(actualResult);
        }