本文整理汇总了C#中MockClients类的典型用法代码示例。如果您正苦于以下问题:C# MockClients类的具体用法?C# MockClients怎么用?C# MockClients使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MockClients类属于命名空间,在下文中一共展示了MockClients类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateContentsOfStagingEnvironmentVariableGroupTest
public void UpdateContentsOfStagingEnvironmentVariableGroupTest()
{
using (ShimsContext.Create())
{
MockClients clients = new MockClients();
string json = @"{
""abc"": 123,
""do-re-me"": ""far-so-la-tee""
}";
clients.JsonResponse = json;
clients.ExpectedStatusCode = (HttpStatusCode)200;
var cfClient = clients.CreateCloudFoundryClient();
UpdateContentsOfStagingEnvironmentVariableGroupRequest value = new UpdateContentsOfStagingEnvironmentVariableGroupRequest();
var obj = cfClient.EnvironmentVariableGroups.UpdateContentsOfStagingEnvironmentVariableGroup(value).Result;
Assert.AreEqual("123", TestUtil.ToTestableString(obj.Abc), true);
Assert.AreEqual("far-so-la-tee", TestUtil.ToTestableString(obj.Doreme), true);
}
}
示例2: SetFeatureFlagTest
public void SetFeatureFlagTest()
{
using (ShimsContext.Create())
{
MockClients clients = new MockClients();
string json = @"{
""name"": ""user_org_creation"",
""enabled"": true,
""error_message"": null,
""url"": ""/v2/config/feature_flags/user_org_creation""
}";
clients.JsonResponse = json;
clients.ExpectedStatusCode = (HttpStatusCode)200;
var cfClient = clients.CreateCloudFoundryClient();
dynamic name = null;
SetFeatureFlagRequest value = new SetFeatureFlagRequest();
var obj = cfClient.FeatureFlags.SetFeatureFlag(name, value).Result;
Assert.AreEqual("user_org_creation", TestUtil.ToTestableString(obj.Name), true);
Assert.AreEqual("true", TestUtil.ToTestableString(obj.Enabled), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj.ErrorMessage), true);
Assert.AreEqual("/v2/config/feature_flags/user_org_creation", TestUtil.ToTestableString(obj.Url), true);
}
}
示例3: GetInfoTest
public void GetInfoTest()
{
using (ShimsContext.Create())
{
MockClients clients = new MockClients();
string json = @"{""name"":""vcap"",""build"":""2222"",""support"":""http://support.cloudfoundry.com"",""version"":2,""description"":""Cloud Foundry sponsored by Pivotal"",""authorization_endpoint"":""http://localhost:8080/uaa"",""token_endpoint"":""http://localhost:8080/uaa"",""api_version"":""2.19.0"",""logging_endpoint"":""ws://loggregator.vcap.me:80""}";
clients.JsonResponse = json;
clients.ExpectedStatusCode = (HttpStatusCode)200;
var cfClient = clients.CreateCloudFoundryClient();
var obj = cfClient.Info.GetInfo().Result;
Assert.AreEqual("vcap", TestUtil.ToTestableString(obj.Name), true);
Assert.AreEqual("2222", TestUtil.ToTestableString(obj.Build), true);
Assert.AreEqual("http://support.cloudfoundry.com", TestUtil.ToTestableString(obj.Support), true);
Assert.AreEqual("2", TestUtil.ToTestableString(obj.Version), true);
Assert.AreEqual("Cloud Foundry sponsored by Pivotal", TestUtil.ToTestableString(obj.Description), true);
Assert.AreEqual("http://localhost:8080/uaa", TestUtil.ToTestableString(obj.AuthorizationEndpoint), true);
Assert.AreEqual("http://localhost:8080/uaa", TestUtil.ToTestableString(obj.TokenEndpoint), true);
Assert.AreEqual("2.19.0", TestUtil.ToTestableString(obj.ApiVersion), true);
Assert.AreEqual("ws://loggregator.vcap.me:80", TestUtil.ToTestableString(obj.LoggingEndpoint), true);
}
}
示例4: GetServiceInstanceCreationFeatureFlagTest
public void GetServiceInstanceCreationFeatureFlagTest()
{
using (ShimsContext.Create())
{
MockClients clients = new MockClients();
string json = @"{
""name"": ""service_instance_creation"",
""enabled"": true,
""error_message"": null,
""url"": ""/v2/config/feature_flags/service_instance_creation""
}";
clients.JsonResponse = json;
clients.ExpectedStatusCode = (HttpStatusCode)200;
var cfClient = clients.CreateCloudFoundryClient();
var obj = cfClient.FeatureFlags.GetServiceInstanceCreationFeatureFlag().Result;
Assert.AreEqual("service_instance_creation", TestUtil.ToTestableString(obj.Name), true);
Assert.AreEqual("true", TestUtil.ToTestableString(obj.Enabled), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj.ErrorMessage), true);
Assert.AreEqual("/v2/config/feature_flags/service_instance_creation", TestUtil.ToTestableString(obj.Url), true);
}
}
示例5: AssociateAuditedSpaceWithUserTest
public void AssociateAuditedSpaceWithUserTest()
{
using (ShimsContext.Create())
{
MockClients clients = new MockClients();
string json = @"{
""metadata"": {
""guid"": ""uaa-id-340"",
""url"": ""/v2/users/uaa-id-340"",
""created_at"": ""2015-05-19T15:27:23+00:00"",
""updated_at"": null
},
""entity"": {
""admin"": false,
""active"": false,
""default_space_guid"": ""dc36e8bc-c991-4a74-a775-20dd2385033b"",
""default_space_url"": ""/v2/spaces/dc36e8bc-c991-4a74-a775-20dd2385033b"",
""spaces_url"": ""/v2/users/uaa-id-340/spaces"",
""organizations_url"": ""/v2/users/uaa-id-340/organizations"",
""managed_organizations_url"": ""/v2/users/uaa-id-340/managed_organizations"",
""billing_managed_organizations_url"": ""/v2/users/uaa-id-340/billing_managed_organizations"",
""audited_organizations_url"": ""/v2/users/uaa-id-340/audited_organizations"",
""managed_spaces_url"": ""/v2/users/uaa-id-340/managed_spaces"",
""audited_spaces_url"": ""/v2/users/uaa-id-340/audited_spaces""
}
}";
clients.JsonResponse = json;
clients.ExpectedStatusCode = (HttpStatusCode)201;
var cfClient = clients.CreateCloudFoundryClient();
Guid? guid = Guid.NewGuid();
Guid? audited_space_guid = Guid.NewGuid();
var obj = cfClient.Users.AssociateAuditedSpaceWithUser(guid, audited_space_guid).Result;
Assert.AreEqual("uaa-id-340", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
Assert.AreEqual("/v2/users/uaa-id-340", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
Assert.AreEqual("2015-05-19T15:27:23+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
Assert.AreEqual("false", TestUtil.ToTestableString(obj.Admin), true);
Assert.AreEqual("false", TestUtil.ToTestableString(obj.Active), true);
Assert.AreEqual("dc36e8bc-c991-4a74-a775-20dd2385033b", TestUtil.ToTestableString(obj.DefaultSpaceGuid), true);
Assert.AreEqual("/v2/spaces/dc36e8bc-c991-4a74-a775-20dd2385033b", TestUtil.ToTestableString(obj.DefaultSpaceUrl), true);
Assert.AreEqual("/v2/users/uaa-id-340/spaces", TestUtil.ToTestableString(obj.SpacesUrl), true);
Assert.AreEqual("/v2/users/uaa-id-340/organizations", TestUtil.ToTestableString(obj.OrganizationsUrl), true);
Assert.AreEqual("/v2/users/uaa-id-340/managed_organizations", TestUtil.ToTestableString(obj.ManagedOrganizationsUrl), true);
Assert.AreEqual("/v2/users/uaa-id-340/billing_managed_organizations", TestUtil.ToTestableString(obj.BillingManagedOrganizationsUrl), true);
Assert.AreEqual("/v2/users/uaa-id-340/audited_organizations", TestUtil.ToTestableString(obj.AuditedOrganizationsUrl), true);
Assert.AreEqual("/v2/users/uaa-id-340/managed_spaces", TestUtil.ToTestableString(obj.ManagedSpacesUrl), true);
Assert.AreEqual("/v2/users/uaa-id-340/audited_spaces", TestUtil.ToTestableString(obj.AuditedSpacesUrl), true);
}
}
示例6: UpdateServiceInstanceTest
public void UpdateServiceInstanceTest()
{
using (ShimsContext.Create())
{
MockClients clients = new MockClients();
string json = @"{
""metadata"": {
""guid"": ""3c1d8405-af3d-48b3-b48a-712fd159ee44"",
""url"": ""/v2/service_instances/3c1d8405-af3d-48b3-b48a-712fd159ee44"",
""created_at"": ""2015-05-19T15:27:17+00:00"",
""updated_at"": ""2015-05-19T15:27:17+00:00""
},
""entity"": {
""name"": ""name-1520"",
""credentials"": {
""creds-key-394"": ""creds-val-394""
},
""service_plan_guid"": ""4a8af901-aed9-4a3f-bdcd-5e3c8c94e2b2"",
""space_guid"": ""197e1b67-5bba-471c-b9e8-dafdba5eb351"",
""gateway_data"": null,
""dashboard_url"": null,
""type"": ""managed_service_instance"",
""space_url"": ""/v2/spaces/197e1b67-5bba-471c-b9e8-dafdba5eb351"",
""service_plan_url"": ""/v2/service_plans/4a8af901-aed9-4a3f-bdcd-5e3c8c94e2b2"",
""service_bindings_url"": ""/v2/service_instances/3c1d8405-af3d-48b3-b48a-712fd159ee44/service_bindings""
}
}";
clients.JsonResponse = json;
clients.ExpectedStatusCode = (HttpStatusCode)201;
var cfClient = clients.CreateCloudFoundryClient();
Guid? guid = Guid.NewGuid();
UpdateServiceInstanceRequest value = new UpdateServiceInstanceRequest();
var obj = cfClient.ServiceInstances.UpdateServiceInstance(guid, value).Result;
Assert.AreEqual("3c1d8405-af3d-48b3-b48a-712fd159ee44", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
Assert.AreEqual("/v2/service_instances/3c1d8405-af3d-48b3-b48a-712fd159ee44", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
Assert.AreEqual("2015-05-19T15:27:17+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
Assert.AreEqual("2015-05-19T15:27:17+00:00", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
Assert.AreEqual("name-1520", TestUtil.ToTestableString(obj.Name), true);
Assert.AreEqual("4a8af901-aed9-4a3f-bdcd-5e3c8c94e2b2", TestUtil.ToTestableString(obj.ServicePlanGuid), true);
Assert.AreEqual("197e1b67-5bba-471c-b9e8-dafdba5eb351", TestUtil.ToTestableString(obj.SpaceGuid), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj.GatewayData), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj.DashboardUrl), true);
Assert.AreEqual("managed_service_instance", TestUtil.ToTestableString(obj.Type), true);
Assert.AreEqual("/v2/spaces/197e1b67-5bba-471c-b9e8-dafdba5eb351", TestUtil.ToTestableString(obj.SpaceUrl), true);
Assert.AreEqual("/v2/service_plans/4a8af901-aed9-4a3f-bdcd-5e3c8c94e2b2", TestUtil.ToTestableString(obj.ServicePlanUrl), true);
Assert.AreEqual("/v2/service_instances/3c1d8405-af3d-48b3-b48a-712fd159ee44/service_bindings", TestUtil.ToTestableString(obj.ServiceBindingsUrl), true);
}
}
示例7: ListAllOrganizationQuotaDefinitionsTest
public void ListAllOrganizationQuotaDefinitionsTest()
{
using (ShimsContext.Create())
{
MockClients clients = new MockClients();
string json = @"{
""total_results"": 1,
""total_pages"": 1,
""prev_url"": null,
""next_url"": null,
""resources"": [
{
""metadata"": {
""guid"": ""0aa4df86-b416-4254-8188-1b2d4a91a417"",
""url"": ""/v2/quota_definitions/0aa4df86-b416-4254-8188-1b2d4a91a417"",
""created_at"": ""2015-05-19T15:27:00+00:00"",
""updated_at"": null
},
""entity"": {
""name"": ""default"",
""non_basic_services_allowed"": true,
""total_services"": 100,
""total_routes"": 1000,
""memory_limit"": 10240,
""trial_db_allowed"": false,
""instance_memory_limit"": -1
}
}
]
}";
clients.JsonResponse = json;
clients.ExpectedStatusCode = (HttpStatusCode)200;
var cfClient = clients.CreateCloudFoundryClient();
var obj = cfClient.OrganizationQuotaDefinitions.ListAllOrganizationQuotaDefinitions().Result;
Assert.AreEqual("1", TestUtil.ToTestableString(obj.Properties.TotalResults), true);
Assert.AreEqual("1", TestUtil.ToTestableString(obj.Properties.TotalPages), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj.Properties.PreviousUrl), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj.Properties.NextUrl), true);
Assert.AreEqual("0aa4df86-b416-4254-8188-1b2d4a91a417", TestUtil.ToTestableString(obj[0].EntityMetadata.Guid), true);
Assert.AreEqual("/v2/quota_definitions/0aa4df86-b416-4254-8188-1b2d4a91a417", TestUtil.ToTestableString(obj[0].EntityMetadata.Url), true);
Assert.AreEqual("2015-05-19T15:27:00+00:00", TestUtil.ToTestableString(obj[0].EntityMetadata.CreatedAt), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj[0].EntityMetadata.UpdatedAt), true);
Assert.AreEqual("default", TestUtil.ToTestableString(obj[0].Name), true);
Assert.AreEqual("true", TestUtil.ToTestableString(obj[0].NonBasicServicesAllowed), true);
Assert.AreEqual("100", TestUtil.ToTestableString(obj[0].TotalServices), true);
Assert.AreEqual("1000", TestUtil.ToTestableString(obj[0].TotalRoutes), true);
Assert.AreEqual("10240", TestUtil.ToTestableString(obj[0].MemoryLimit), true);
Assert.AreEqual("false", TestUtil.ToTestableString(obj[0].TrialDbAllowed), true);
Assert.AreEqual("-1", TestUtil.ToTestableString(obj[0].InstanceMemoryLimit), true);
}
}
示例8: RetrieveServiceBindingTest
public void RetrieveServiceBindingTest()
{
using (ShimsContext.Create())
{
MockClients clients = new MockClients();
string json = @"{
""metadata"": {
""guid"": ""63c94a33-7a30-437e-b2af-51755fb7298b"",
""url"": ""/v2/service_bindings/63c94a33-7a30-437e-b2af-51755fb7298b"",
""created_at"": ""2015-05-19T15:27:19+00:00"",
""updated_at"": null
},
""entity"": {
""app_guid"": ""a88dc53f-510c-440c-9d6c-627e52919808"",
""service_instance_guid"": ""64b70b6d-cfa4-4c51-a9f3-e1106f8abceb"",
""credentials"": {
""creds-key-429"": ""creds-val-429""
},
""binding_options"": {
},
""gateway_data"": null,
""gateway_name"": """",
""syslog_drain_url"": null,
""app_url"": ""/v2/apps/a88dc53f-510c-440c-9d6c-627e52919808"",
""service_instance_url"": ""/v2/service_instances/64b70b6d-cfa4-4c51-a9f3-e1106f8abceb""
}
}";
clients.JsonResponse = json;
clients.ExpectedStatusCode = (HttpStatusCode)200;
var cfClient = clients.CreateCloudFoundryClient();
Guid? guid = Guid.NewGuid();
var obj = cfClient.ServiceBindings.RetrieveServiceBinding(guid).Result;
Assert.AreEqual("63c94a33-7a30-437e-b2af-51755fb7298b", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
Assert.AreEqual("/v2/service_bindings/63c94a33-7a30-437e-b2af-51755fb7298b", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
Assert.AreEqual("2015-05-19T15:27:19+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
Assert.AreEqual("a88dc53f-510c-440c-9d6c-627e52919808", TestUtil.ToTestableString(obj.AppGuid), true);
Assert.AreEqual("64b70b6d-cfa4-4c51-a9f3-e1106f8abceb", TestUtil.ToTestableString(obj.ServiceInstanceGuid), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj.GatewayData), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj.GatewayName), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj.SyslogDrainUrl), true);
Assert.AreEqual("/v2/apps/a88dc53f-510c-440c-9d6c-627e52919808", TestUtil.ToTestableString(obj.AppUrl), true);
Assert.AreEqual("/v2/service_instances/64b70b6d-cfa4-4c51-a9f3-e1106f8abceb", TestUtil.ToTestableString(obj.ServiceInstanceUrl), true);
}
}
示例9: UpdateServicePlanDeprecatedTest
public void UpdateServicePlanDeprecatedTest()
{
using (ShimsContext.Create())
{
MockClients clients = new MockClients();
string json = @"{
""metadata"": {
""guid"": ""bef1866c-7b3e-44cc-bfc9-aea9375f7d62"",
""url"": ""/v2/service_plans/bef1866c-7b3e-44cc-bfc9-aea9375f7d62"",
""created_at"": ""2015-05-19T15:27:03+00:00"",
""updated_at"": ""2015-05-19T15:27:03+00:00""
},
""entity"": {
""name"": ""100mb"",
""free"": true,
""description"": ""Let's you put data in your database!"",
""service_guid"": ""718bd9cb-7309-481a-b930-8d09f9dff045"",
""extra"": null,
""unique_id"": ""54623a44-83a5-4b17-a4ac-2b01a1cc7033"",
""public"": true,
""active"": true,
""service_url"": ""/v2/services/718bd9cb-7309-481a-b930-8d09f9dff045"",
""service_instances_url"": ""/v2/service_plans/bef1866c-7b3e-44cc-bfc9-aea9375f7d62/service_instances""
}
}";
clients.JsonResponse = json;
clients.ExpectedStatusCode = (HttpStatusCode)201;
var cfClient = clients.CreateCloudFoundryClient();
UpdateServicePlanDeprecatedRequest value = new UpdateServicePlanDeprecatedRequest();
var obj = cfClient.ServicePlans.UpdateServicePlanDeprecated(value).Result;
Assert.AreEqual("bef1866c-7b3e-44cc-bfc9-aea9375f7d62", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
Assert.AreEqual("/v2/service_plans/bef1866c-7b3e-44cc-bfc9-aea9375f7d62", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
Assert.AreEqual("2015-05-19T15:27:03+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
Assert.AreEqual("2015-05-19T15:27:03+00:00", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
Assert.AreEqual("100mb", TestUtil.ToTestableString(obj.Name), true);
Assert.AreEqual("true", TestUtil.ToTestableString(obj.Free), true);
Assert.AreEqual("Let's you put data in your database!", TestUtil.ToTestableString(obj.Description), true);
Assert.AreEqual("718bd9cb-7309-481a-b930-8d09f9dff045", TestUtil.ToTestableString(obj.ServiceGuid), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj.Extra), true);
Assert.AreEqual("54623a44-83a5-4b17-a4ac-2b01a1cc7033", TestUtil.ToTestableString(obj.UniqueId), true);
Assert.AreEqual("true", TestUtil.ToTestableString(obj.Public), true);
Assert.AreEqual("true", TestUtil.ToTestableString(obj.Active), true);
Assert.AreEqual("/v2/services/718bd9cb-7309-481a-b930-8d09f9dff045", TestUtil.ToTestableString(obj.ServiceUrl), true);
Assert.AreEqual("/v2/service_plans/bef1866c-7b3e-44cc-bfc9-aea9375f7d62/service_instances", TestUtil.ToTestableString(obj.ServiceInstancesUrl), true);
}
}
示例10: UpdateSpaceQuotaDefinitionTest
public void UpdateSpaceQuotaDefinitionTest()
{
using (ShimsContext.Create())
{
MockClients clients = new MockClients();
string json = @"{
""metadata"": {
""guid"": ""a191a666-6286-4631-8317-7571674bb3ab"",
""url"": ""/v2/space_quota_definitions/a191a666-6286-4631-8317-7571674bb3ab"",
""created_at"": ""2015-05-19T15:27:04+00:00"",
""updated_at"": ""2015-05-19T15:27:04+00:00""
},
""entity"": {
""name"": ""name-87"",
""organization_guid"": ""200d06c1-61d1-47af-8213-b939ad71e2f8"",
""non_basic_services_allowed"": true,
""total_services"": 60,
""total_routes"": 1000,
""memory_limit"": 20480,
""instance_memory_limit"": -1,
""organization_url"": ""/v2/organizations/200d06c1-61d1-47af-8213-b939ad71e2f8"",
""spaces_url"": ""/v2/space_quota_definitions/a191a666-6286-4631-8317-7571674bb3ab/spaces""
}
}";
clients.JsonResponse = json;
clients.ExpectedStatusCode = (HttpStatusCode)201;
var cfClient = clients.CreateCloudFoundryClient();
Guid? guid = Guid.NewGuid();
UpdateSpaceQuotaDefinitionRequest value = new UpdateSpaceQuotaDefinitionRequest();
var obj = cfClient.SpaceQuotaDefinitions.UpdateSpaceQuotaDefinition(guid, value).Result;
Assert.AreEqual("a191a666-6286-4631-8317-7571674bb3ab", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
Assert.AreEqual("/v2/space_quota_definitions/a191a666-6286-4631-8317-7571674bb3ab", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
Assert.AreEqual("2015-05-19T15:27:04+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
Assert.AreEqual("2015-05-19T15:27:04+00:00", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
Assert.AreEqual("name-87", TestUtil.ToTestableString(obj.Name), true);
Assert.AreEqual("200d06c1-61d1-47af-8213-b939ad71e2f8", TestUtil.ToTestableString(obj.OrganizationGuid), true);
Assert.AreEqual("true", TestUtil.ToTestableString(obj.NonBasicServicesAllowed), true);
Assert.AreEqual("60", TestUtil.ToTestableString(obj.TotalServices), true);
Assert.AreEqual("1000", TestUtil.ToTestableString(obj.TotalRoutes), true);
Assert.AreEqual("20480", TestUtil.ToTestableString(obj.MemoryLimit), true);
Assert.AreEqual("-1", TestUtil.ToTestableString(obj.InstanceMemoryLimit), true);
Assert.AreEqual("/v2/organizations/200d06c1-61d1-47af-8213-b939ad71e2f8", TestUtil.ToTestableString(obj.OrganizationUrl), true);
Assert.AreEqual("/v2/space_quota_definitions/a191a666-6286-4631-8317-7571674bb3ab/spaces", TestUtil.ToTestableString(obj.SpacesUrl), true);
}
}
示例11: CreateUserProvidedServiceInstanceTest
public void CreateUserProvidedServiceInstanceTest()
{
using (ShimsContext.Create())
{
MockClients clients = new MockClients();
string json = @"{
""metadata"": {
""guid"": ""8480da86-d508-4c31-b597-4c6ec4dad99a"",
""url"": ""/v2/user_provided_service_instances/8480da86-d508-4c31-b597-4c6ec4dad99a"",
""created_at"": ""2015-05-19T15:27:04+00:00"",
""updated_at"": null
},
""entity"": {
""name"": ""my-user-provided-instance"",
""credentials"": {
""somekey"": ""somevalue""
},
""space_guid"": ""aeaa5401-be2a-4c35-9520-ee478c9ffda8"",
""type"": ""user_provided_service_instance"",
""syslog_drain_url"": ""syslog://example.com"",
""space_url"": ""/v2/spaces/aeaa5401-be2a-4c35-9520-ee478c9ffda8"",
""service_bindings_url"": ""/v2/user_provided_service_instances/8480da86-d508-4c31-b597-4c6ec4dad99a/service_bindings""
}
}";
clients.JsonResponse = json;
clients.ExpectedStatusCode = (HttpStatusCode)201;
var cfClient = clients.CreateCloudFoundryClient();
CreateUserProvidedServiceInstanceRequest value = new CreateUserProvidedServiceInstanceRequest();
var obj = cfClient.UserProvidedServiceInstances.CreateUserProvidedServiceInstance(value).Result;
Assert.AreEqual("8480da86-d508-4c31-b597-4c6ec4dad99a", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
Assert.AreEqual("/v2/user_provided_service_instances/8480da86-d508-4c31-b597-4c6ec4dad99a", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
Assert.AreEqual("2015-05-19T15:27:04+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
Assert.AreEqual("my-user-provided-instance", TestUtil.ToTestableString(obj.Name), true);
Assert.AreEqual("aeaa5401-be2a-4c35-9520-ee478c9ffda8", TestUtil.ToTestableString(obj.SpaceGuid), true);
Assert.AreEqual("user_provided_service_instance", TestUtil.ToTestableString(obj.Type), true);
Assert.AreEqual("syslog://example.com", TestUtil.ToTestableString(obj.SyslogDrainUrl), true);
Assert.AreEqual("/v2/spaces/aeaa5401-be2a-4c35-9520-ee478c9ffda8", TestUtil.ToTestableString(obj.SpaceUrl), true);
Assert.AreEqual("/v2/user_provided_service_instances/8480da86-d508-4c31-b597-4c6ec4dad99a/service_bindings", TestUtil.ToTestableString(obj.ServiceBindingsUrl), true);
}
}
示例12: FilterPrivateDomainsByNameTest
public void FilterPrivateDomainsByNameTest()
{
using (ShimsContext.Create())
{
MockClients clients = new MockClients();
string json = @"{
""total_results"": 1,
""total_pages"": 1,
""prev_url"": null,
""next_url"": null,
""resources"": [
{
""metadata"": {
""guid"": ""e7892705-e518-46b5-b39f-3e60d90506e4"",
""url"": ""/v2/private_domains/e7892705-e518-46b5-b39f-3e60d90506e4"",
""created_at"": ""2015-05-19T15:27:05+00:00"",
""updated_at"": null
},
""entity"": {
""name"": ""my-domain.com"",
""owning_organization_guid"": ""2ff34cae-f15d-4319-8515-4db5be74220a"",
""owning_organization_url"": ""/v2/organizations/2ff34cae-f15d-4319-8515-4db5be74220a""
}
}
]
}";
clients.JsonResponse = json;
clients.ExpectedStatusCode = (HttpStatusCode)200;
var cfClient = clients.CreateCloudFoundryClient();
var obj = cfClient.PrivateDomains.FilterPrivateDomainsByName().Result;
Assert.AreEqual("1", TestUtil.ToTestableString(obj.Properties.TotalResults), true);
Assert.AreEqual("1", TestUtil.ToTestableString(obj.Properties.TotalPages), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj.Properties.PreviousUrl), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj.Properties.NextUrl), true);
Assert.AreEqual("e7892705-e518-46b5-b39f-3e60d90506e4", TestUtil.ToTestableString(obj[0].EntityMetadata.Guid), true);
Assert.AreEqual("/v2/private_domains/e7892705-e518-46b5-b39f-3e60d90506e4", TestUtil.ToTestableString(obj[0].EntityMetadata.Url), true);
Assert.AreEqual("2015-05-19T15:27:05+00:00", TestUtil.ToTestableString(obj[0].EntityMetadata.CreatedAt), true);
Assert.AreEqual("", TestUtil.ToTestableString(obj[0].EntityMetadata.UpdatedAt), true);
Assert.AreEqual("my-domain.com", TestUtil.ToTestableString(obj[0].Name), true);
Assert.AreEqual("2ff34cae-f15d-4319-8515-4db5be74220a", TestUtil.ToTestableString(obj[0].OwningOrganizationGuid), true);
Assert.AreEqual("/v2/organizations/2ff34cae-f15d-4319-8515-4db5be74220a", TestUtil.ToTestableString(obj[0].OwningOrganizationUrl), true);
}
}
示例13: DeleteServiceBrokerTest
public void DeleteServiceBrokerTest()
{
using (ShimsContext.Create())
{
MockClients clients = new MockClients();
clients.ExpectedStatusCode = (HttpStatusCode)204;
var cfClient = clients.CreateCloudFoundryClient();
Guid? guid = Guid.NewGuid();
cfClient.ServiceBrokers.DeleteServiceBroker(guid).Wait();
}
}
示例14: RemovingSecurityGroupAsDefaultForRunningAppsTest
public void RemovingSecurityGroupAsDefaultForRunningAppsTest()
{
using (ShimsContext.Create())
{
MockClients clients = new MockClients();
clients.ExpectedStatusCode = (HttpStatusCode)204;
var cfClient = clients.CreateCloudFoundryClient();
Guid? guid = Guid.NewGuid();
cfClient.SecurityGroupRunningDefaults.RemovingSecurityGroupAsDefaultForRunningApps(guid).Wait();
}
}
示例15: DeleteUserProvidedServiceInstanceTest
public void DeleteUserProvidedServiceInstanceTest()
{
using (ShimsContext.Create())
{
MockClients clients = new MockClients();
clients.ExpectedStatusCode = (HttpStatusCode)204;
var cfClient = clients.CreateCloudFoundryClient();
Guid? guid = Guid.NewGuid();
cfClient.UserProvidedServiceInstances.DeleteUserProvidedServiceInstance(guid).Wait();
}
}