Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }