コード例 #1
0
        internal static IIdentityService CreateService(TestCredentials credentials, bool logRequests = true)
        {
            if (credentials == null)
                throw new ArgumentNullException("credentials");

            IdentityClient client;
            switch (credentials.Vendor)
            {
            case "HP":
                // currently HP does not have a vendor-specific IIdentityService
                goto default;

            case "Rackspace":
                client = new RackspaceIdentityClient(credentials.BaseAddress);
                break;

            case "OpenStack":
            default:
                client = new IdentityClient(credentials.BaseAddress);
                break;
            }

            TestProxy.ConfigureService(client, credentials.Proxy);
            if (logRequests)
            {
                client.BeforeAsyncWebRequest += TestHelpers.HandleBeforeAsyncWebRequest;
                client.AfterAsyncWebResponse += TestHelpers.HandleAfterAsyncWebResponse;
            }

            return client;
        }
コード例 #2
0
        protected IIdentityService CreateService(IAuthenticationService authenticationService, bool logRequests = true)
        {
            IdentityClient client;
            switch (Vendor)
            {
            case "HP":
                // currently HP does not have a vendor-specific IIdentityService
                goto default;

            case "Rackspace":
                client = new RackspaceIdentityClient(authenticationService, BaseAddress);
                break;

            case "OpenStack":
            default:
                client = new IdentityClient(authenticationService, BaseAddress);
                break;
            }

            TestProxy.ConfigureService(client, Proxy);
            if (logRequests)
            {
                client.BeforeAsyncWebRequest += TestHelpers.HandleBeforeAsyncWebRequest;
                client.AfterAsyncWebResponse += TestHelpers.HandleAfterAsyncWebResponse;
            }

            return client;
        }
コード例 #3
0
        protected IBaseIdentityService CreateService()
        {
            BaseIdentityClient client;
            switch (Vendor)
            {
            case "HP":
                // currently HP does not have a vendor-specific IBaseIdentityService
                goto default;

            case "Rackspace":
                client = new RackspaceIdentityClient(BaseAddress);
                break;

            case "OpenStack":
            default:
                client = new BaseIdentityClient(BaseAddress);
                break;
            }

            TestProxy.ConfigureService(client, Proxy);
            client.BeforeAsyncWebRequest += TestHelpers.HandleBeforeAsyncWebRequest;
            client.AfterAsyncWebResponse += TestHelpers.HandleAfterAsyncWebResponse;

            return client;
        }