public async Task Should_retrieve_a_boardgame_by_id()
        {
            ThingResponse response = await bgg.GetThingAsync(new ThingRequest(new int[] { 172818 }, versions : true));

            Assert.True(response.Succeeded);

            ThingResponse.Item game = response.Result.FirstOrDefault();
            Assert.NotNull(game);

            Assert.Equal(172818, game.Id);
            Assert.Equal("boardgame", game.Type);
            Assert.NotNull(game.Thumbnail);
            Assert.NotNull(game.Image);
            Assert.Equal("Above and Below", game.Name);
            Assert.Equal(6, game.AlternateNames.Count);
            Assert.StartsWith("Your last village was ransacked by barbarians.", game.Description);
            Assert.Equal(2015, game.YearPublished);
            Assert.Equal(2, game.MinPlayers);
            Assert.Equal(4, game.MaxPlayers);
            Assert.Equal(90, game.PlayingTime);
            Assert.Equal(90, game.MinPlayingTime);
            Assert.Equal(90, game.MaxPlayingTime);
            Assert.Equal(13, game.MinAge);
            Assert.Equal(3, game.Polls.Count);
            Assert.Equal(43, game.Links.Count);
            Assert.Equal(9, game.Versions.Count);
        }
예제 #2
0
        // GET: /Games/TestAPIAsync
        public async Task <IActionResult> TestAPIAsync()
        {
            ThingRequest  request  = new ThingRequest(new[] { 161936 });
            ThingResponse response = await _bgg.GetThingAsync(request);

            // not sure that this will work
            ThingResponse.Item pandemicLegacySeason1 = response.Result[0];
            return(View(pandemicLegacySeason1));
        }
        public static async Task <ThingResponse.Item> GetBoardGameAsync(this IBoardGameGeekXmlApi2Client bggClient, int id)
        {
            var request = new ThingRequest(
                new[] { id },
                types: new[] { "boardgame" },
                stats: true);

            ThingResponse response = await bggClient.GetThingAsync(request);

            return(response.Result.FirstOrDefault());
        }
예제 #4
0
        public async static Task <ThingResponse.Item> GetGameAsync(this IBoardGameGeekXmlApi2Client client, int gameId)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
            var request  = new ThingRequest(new[] { gameId });
            var response = await client.GetThingAsync(request);

            return(response.Result.FirstOrDefault());
        }
        public static async Task <IEnumerable <ThingResponse.Item> > GetBoardGamesAsync(this IBoardGameGeekXmlApi2Client bggClient, params int[] ids)
        {
            var request = new ThingRequest(
                ids,
                types: new[] { "boardgame" },
                stats: true);

            ThingResponse response = await bggClient.GetThingAsync(request);

            return(response.Result);
        }