Пример #1
0
        public void InvalidMethodVersion_RequestFails()
        {
            var response = DotaApiClient.GetPlayerItemsAsync(76561198107435620,
                                                             version: "v8.3").Result;

            SleepAfterSendingRequest();

            AssertRequestFailed(response);
            Assert.Null(response.Contents);
        }
Пример #2
0
        public void InvalidApiInterface_RequestFails()
        {
            var response = DotaApiClient.GetPlayerItemsAsync(76561198107435620,
                                                             apiInterface: "IDota_2_Cosmetics").Result;

            SleepAfterSendingRequest();

            AssertRequestFailed(response);
            Assert.Null(response.Contents);
        }
Пример #3
0
        public void PrivateInventory_ReturnsWithStatus15()
        {
            var response = DotaApiClient.GetPlayerItemsAsync(76561198059119066)
                           .Result;

            SleepAfterSendingRequest();

            AssertRequestFailed(response);
            var thrown = response.ThrownException as ApiException;

            Assert.Equal((uint)15, thrown.ApiStatusCode);
        }
Пример #4
0
        public void ValidPlayerId_ReturnsPlayersItems(ulong id)
        {
            var response = DotaApiClient.GetPlayerItemsAsync(id)
                           .Result;

            SleepAfterSendingRequest();

            AssertRequestWasSuccessful(response);
            Assert.NotNull(response.Contents);
            Assert.NotEmpty(response.Contents.Items);

            Assert.All(response.Contents.Items, item =>
            {
                Assert.NotEqual((ulong)0, item.Id);
            });
        }
Пример #5
0
        public async Task MethodGotCancelled_RequestFails()
        {
            CancellationTokenSource source = new CancellationTokenSource();

            // Start task to be cancelled
            var task = Task.Run(async() =>
            {
                return(await DotaApiClient.GetPlayerItemsAsync(76561198107435620,
                                                               cToken: source.Token));
            });

            // Cancel method
            source.Cancel();

            var response = await task;

            SleepAfterSendingRequest();

            AssertRequestWasCancelled(response);
            Assert.Null(response.Contents);
        }