public async Task GetAutocompletePredictionsAsync_SingleCall_PredictionsOk() { //arrange var tester = new AutocompleteTester(policyFactory, googleMock); //act var result = await tester.GetAutocompletePredictionsAsync("Foo"); //assert result.LastOrDefault().Should().Be("Foot bal"); }
public async Task GetAutocompletePredictionsAsync_Caching_SecondCallReturnsFromCache() { //arrange var tester = new AutocompleteTester(policyFactory, googleMock); //act var result1 = await tester.GetAutocompletePredictionsAsync("Foo"); var result2 = await tester.GetAutocompletePredictionsAsync("Ben"); var result3 = await tester.GetAutocompletePredictionsAsync("Foo"); //assert result3.LastOrDefault().Should().Be("Foot bal"); await googleMock.Received(1).GetPredictionsAsync("Foo"); }