public async Task <Offer> GetOfferAsync(string offerId) { var offer = _offerRepository.Get(offerId); var coordinates = await _geoCodeProvider.GetCoordinatesAsync($"{offer.Location.City}, {offer.Location.Street} {offer.Location.HouseNumber}"); offer.Location.Coordinates = coordinates; return(offer); }
public async Task GetOffer_ShouldReturnOffer() { // Arrange var expected = new Offer() { Location = new Location() { Coordinates = new Coordinates() { Latitude = 1, Longitude = 2 }, City = "city", HouseNumber = "1" } }; var offerId = "offerId"; var offer = new Offer() { Location = new Location() { City = "city", HouseNumber = "1" } }; _offerRepositoryMock.Get(offerId).Returns(offer); _geoCodeProviderMock.GetCoordinatesAsync(Arg.Any <string>()).Returns(new Coordinates() { Latitude = 1, Longitude = 2 }); // Act var result = await _offerService.GetOfferAsync(offerId); // Assert result.Should().BeEquivalentTo(expected); }