public async Task GetAllGames_ReturnsAllAvailableGames() { //Arrange var results = _fixture.Create <GetGamesResults>(); var gamesInDb = _fixture.CreateMany <Game>(5); _mockGameRepository .Setup(exec => exec.GetAllAvailableGamesAsync(It.IsAny <CancellationToken>())) .ReturnsAsync(gamesInDb); //Act var result = await _gameController .GetAllGamesAsync() as OkObjectResult; //Assert _mockGameRepository .Verify(exec => exec.GetAllAvailableGamesAsync( It.IsAny <CancellationToken>()), Times.Once); result .Should() .NotBeNull(); result.StatusCode .Should() .Be((int)HttpStatusCode.OK); var gamesResult = result.Value as GetGamesResults; gamesResult.Games.Count() .Should() .Be(gamesInDb.Count()); }