Ejemplo n.º 1
0
        public void TestListEndpoints()
        {
            IIdentityProvider provider   = Bootstrapper.CreateIdentityProvider();
            UserAccess        userAccess = provider.Authenticate();

            Assert.IsNotNull(userAccess);
            Assert.IsNotNull(userAccess.Token);
            Assert.IsNotNull(userAccess.Token.Id);

            try
            {
                IEnumerable <ExtendedEndpoint> endpoints = provider.ListEndpoints(userAccess.Token.Id);
                Console.WriteLine(JsonConvert.SerializeObject(userAccess, Formatting.Indented));
            }
            catch (UserNotAuthorizedException ex)
            {
                if (ex.Response.StatusCode != HttpStatusCode.Forbidden)
                {
                    throw;
                }

                Assert.Inconclusive("The service does not allow this user to access the List Endpoints API.");
            }
        }