Beispiel #1
0
        public async Task FetchAllItemsIds_ItemId_ReturnsAllItemsWithValidIds()
        {
            LoLMetadataViewModel metadata = await LoLAPIUtil.FetchAPIMetadataAsync();

            List <ItemViewModel> items = await LoLAPIUtil.FetchAllItemAsync(metadata.BaseUrlAPI, metadata.Version);

            Assert.True(items.Count > 0);

            // Ensure that we have ID > 0, test with the first element
            Assert.True(items[0].Id > 0);
        }
Beispiel #2
0
        public async Task InitAsync()
        {
            // 1- Fetch metadata
            LoLMetadataViewModel metadata = await LoLAPIUtil.FetchAPIMetadataAsync();

            BaseUrlAPI = metadata.BaseUrlAPI;
            Version    = metadata.Version;

            // 2- Fetch champions and items
            var fetchChampionsTask = LoLAPIUtil.FetchAllChampionsAsync(BaseUrlAPI, Version);
            var fetchItemsTask     = LoLAPIUtil.FetchAllItemAsync(BaseUrlAPI, Version);
            await Task.WhenAll(fetchChampionsTask, fetchItemsTask);

            Champions = fetchChampionsTask.Result;
            Items     = fetchItemsTask.Result;
        }