public async Task GetAsync_CallsGateway_ReturnValue() { //Arrange starshipGateway.GetAsync().Returns(fixture.CreateMany <Starship>()); //Act var starships = await starshipService.GetAsync().ConfigureAwait(false); //Assert starships.Should().NotBeEmpty(); await starshipGateway.Received(1).GetAsync().ConfigureAwait(false); }
public async void ShouldRetrieveStarships() { var mockedData = _fixture.MockedData(); _swApiClient.Setup(x => x.GetStarshipsAsync()).ReturnsAsync(mockedData); var _starshipService = new StarshipService(_swApiClient.Object, _calculator.Object); IEnumerable <Starship> starships = await _starshipService.GetAsync(); starships.Should().NotBeEmpty().And.HaveCount(mockedData.Count()); _swApiClient.Verify(x => x.GetStarshipsAsync(), Times.Once); }