Exemplo n.º 1
0
        public async Task ClearResourceListCacheOfSpecificType()
        {
            // assemble
            PokeApiClient sut = CreateSut();

            mockHttp.Expect("*machine")
            .Respond("application/json", JsonConvert.SerializeObject(CreateFakeApiResourceList <Machine>()));
            mockHttp.Expect("*berry")
            .Respond("application/json", JsonConvert.SerializeObject(CreateFakeNamedResourceList <Berry>()));
            mockHttp.Expect("*machine")
            .Respond("application/json", JsonConvert.SerializeObject(CreateFakeApiResourceList <Machine>()));

            // act
            await sut.GetApiResourcePageAsync <Machine>();

            await sut.GetNamedResourcePageAsync <Berry>();

            sut.ClearResourceListCache <Machine>();
            await sut.GetApiResourcePageAsync <Machine>();

            await sut.GetNamedResourcePageAsync <Berry>();

            // assert
            mockHttp.VerifyNoOutstandingExpectation();
        }