public async Task GetNextPageNumberAsync_Should_Return_CorrectPage(int id, int expectedPage) { // Arrange var tvMazeServiceMock = new Mock <ITvMazeService>(); var showsRepositoryMock = new Mock <IShowsRepository>(); var personsRepositoryMock = new Mock <IPersonsRepository>(); showsRepositoryMock.Setup(i => i.GetLastShowAsync()).ReturnsAsync(() => new Show(id, "test")); // Act var commandHandler = new SyncTvMazeDbCommandHandler(tvMazeServiceMock.Object, showsRepositoryMock.Object, personsRepositoryMock.Object); // Assert var result = await commandHandler.GetNextPageNumberAsync(); Assert.AreEqual(expectedPage, result); }
public async Task GetNextPageNumberAsync_EmptyStorage_Should_Return_Zero() { // Arrange var tvMazeServiceMock = new Mock <ITvMazeService>(); var showsRepositoryMock = new Mock <IShowsRepository>(); var personsRepositoryMock = new Mock <IPersonsRepository>(); showsRepositoryMock.Setup(i => i.GetLastShowAsync()).ReturnsAsync(() => (Show)null); // Act var commandHandler = new SyncTvMazeDbCommandHandler(tvMazeServiceMock.Object, showsRepositoryMock.Object, personsRepositoryMock.Object); // Assert var result = await commandHandler.GetNextPageNumberAsync(); Assert.AreEqual(0, result); }