This class defines an authentication service based on the OpenStack Identity Service V2.
Inheritance: IAuthenticationService
        internal static IAuthenticationService CreateAuthenticationService(TestCredentials credentials, bool logRequests = true)
        {
            if (credentials == null)
                throw new ArgumentNullException("credentials");

            IIdentityService identityService = CreateService(credentials, logRequests);
            IAuthenticationService authenticationService;
            switch (credentials.Vendor)
            {
            case "HP":
                // currently HP does not have a vendor-specific IIdentityService
                goto default;

            case "Rackspace":
                authenticationService = new RackspaceAuthenticationService(identityService, credentials.AuthenticationRequest);
                break;

            case "OpenStack":
            default:
                authenticationService = new IdentityV2AuthenticationService(identityService, credentials.AuthenticationRequest);
                break;
            }

            return authenticationService;
        }
        public async Task TestListTenants()
        {
            using (CancellationTokenSource cancellationTokenSource = new CancellationTokenSource())
            {
                cancellationTokenSource.CancelAfter(TestTimeout(TimeSpan.FromSeconds(10)));

                TestCredentials credentials = Credentials;
                Assert.IsNotNull(credentials);

                AuthenticationRequest request = credentials.AuthenticationRequest;
                Assert.IsNotNull(request);

                IdentityV2AuthenticationService authenticationService = new IdentityV2AuthenticationService(CreateService(), request);

                using (IIdentityService service = CreateService(authenticationService))
                {
                    ListTenantsApiCall apiCall = await service.PrepareListTenantsAsync(cancellationTokenSource.Token);
                    Tuple<HttpResponseMessage, ReadOnlyCollectionPage<Tenant>> response = await apiCall.SendAsync(cancellationTokenSource.Token);

                    Assert.IsNotNull(response);
                    Assert.IsNotNull(response.Item2);

                    ReadOnlyCollectionPage<Tenant> tenants = response.Item2;
                    Assert.IsNotNull(tenants);
                    Assert.AreNotEqual(0, tenants.Count);
                    Assert.IsFalse(tenants.CanHaveNextPage);

                    foreach (Tenant tenant in tenants)
                        CheckTenant(tenant);

                    Assert.IsTrue(tenants.Any(i => i.Enabled ?? false));
                }
            }
        }