public void Should_Return_Correct_Endpoint_When_Identity_Is_Explicitly_Set_And_Region_Is_Explicitly_Declared()
        {
            UserAccess userAccess = JsonConvert.DeserializeObject <UserAccess>(
                @"{ serviceCatalog:[{ type : """ + _testService + @""", endpoints : [{region:""DFW""}, {region:""ORD""}]}], user:{""RAX-AUTH:defaultRegion"":""DFW""} }");

            var identityProviderMock = new Mock <IIdentityProvider>();

            identityProviderMock.Setup(m => m.GetUserAccess(It.IsAny <CloudIdentity>(), It.IsAny <bool>())).Returns(userAccess);
            var provider = new MockProvider(null, identityProviderMock.Object, null);

            var endpoint = provider.GetEndpoint(_testService, "DFW", new CloudIdentity());

            Assert.IsNotNull(endpoint);
            Assert.AreEqual("DFW", endpoint.Region);
        }
        public void Should_Return_Correct_LON_Endpoint_When_Identity_Is_Set_On_Provider_And_Region_Is_Always_Null()
        {
            UserAccess userAccess = JsonConvert.DeserializeObject <UserAccess>(
                @"{ serviceCatalog:[{ type : """ + _testService + @""", endpoints : [{region:""LON""}, {region:""LON2""}]}], user:{""RAX-AUTH:defaultRegion"":null} }");

            var identityProviderMock = new Mock <IIdentityProvider>();

            identityProviderMock.Setup(m => m.GetUserAccess(It.IsAny <CloudIdentity>(), It.IsAny <bool>())).Returns(userAccess);
            var provider = new MockProvider(new RackspaceCloudIdentity {
                CloudInstance = CloudInstance.UK
            }, identityProviderMock.Object, null);

            var endpoint = provider.GetEndpoint(_testService, null, null);

            Assert.IsNotNull(endpoint);
            Assert.AreEqual("LON", endpoint.Region);
        }