Пример #1
0
        public void GuideStarPremierResourceWorks()
        {
            var premier = PremierResource.GetOrganization("13-1837418");

            var result = JsonDocument.Parse(premier);

            result.RootElement.TryGetProperty("code", out var response);
            Assert.True(response.TryGetInt32(out int code));
            Assert.True(code == 200);

            Assert.NotNull(premier);
        }
Пример #2
0
        public void GetOrganization_Works()
        {
            var charitycheck = PremierResource.GetOrganization("13-1837418");
            var result       = JsonDocument.Parse(charitycheck);

            result.RootElement.TryGetProperty("code", out var response);
            Assert.True(response.TryGetInt32(out int code));
            Assert.True(code == 200);

            Assert.NotNull(charitycheck);
            Assert.Contains("charity", charitycheck);
        }
Пример #3
0
        public void GuideStarClient_BadSubscriptionKey_Expect401()
        {
            GuideStarClient.SubscriptionKeys[Domain.PremierV3] = new SubscriptionKey("01234567890123456789012345678901"); // 32

            try
            {
                var premier = PremierResource.GetOrganization("13-1837418");
                Assert.True(false); // Fail - shouldn't have worked
            }
            catch (ApiException ex)
            {
                Assert.NotNull(ex.Response);
                Assert.Equal(System.Net.HttpStatusCode.Unauthorized, ex.Response.StatusCode);
            }
            catch (Exception)
            {
                Assert.True(false); // Fail - wrong exception type
            }
        }