示例#1
0
        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");
        }
示例#2
0
        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");
        }