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);

            }
        }
Beispiel #2
0
        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);

            }
        }
        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);

            }
        }
Beispiel #4
0
        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);

            }
        }
        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);

            }
        }
        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);

            }
        }
        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);

            }
        }
        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);

            }
        }
        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);

            }
        }
        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);

            }
        }
        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);

            }
        }
        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();

            }
        }
        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();

            }
        }
        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();

            }
        }
        public void SetSecurityGroupAsDefaultForRunningAppsTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""b809577b-e391-468d-8b41-6e4379a9852f"",
    ""url"": ""/v2/config/running_security_groups/b809577b-e391-468d-8b41-6e4379a9852f"",
    ""created_at"": ""2015-05-19T15:27:02+00:00"",
    ""updated_at"": ""2015-05-19T15:27:02+00:00""
  },
  ""entity"": {
    ""name"": ""name-28"",
    ""rules"": [
      {
        ""protocol"": ""udp"",
        ""ports"": ""8080"",
        ""destination"": ""198.41.191.47/1""
      }
    ],
    ""running_default"": true,
    ""staging_default"": false
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid? guid = Guid.NewGuid();


                var obj = cfClient.SecurityGroupRunningDefaults.SetSecurityGroupAsDefaultForRunningApps(guid).Result;


                Assert.AreEqual("b809577b-e391-468d-8b41-6e4379a9852f", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/config/running_security_groups/b809577b-e391-468d-8b41-6e4379a9852f", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2015-05-19T15:27:02+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("2015-05-19T15:27:02+00:00", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("name-28", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("true", TestUtil.ToTestableString(obj.RunningDefault), true);
                Assert.AreEqual("false", TestUtil.ToTestableString(obj.StagingDefault), true);

            }
        }
        public void ChangePositionOfBuildpackTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""c428eba4-dbc5-4034-bf21-5bdad5335d84"",
    ""url"": ""/v2/buildpacks/c428eba4-dbc5-4034-bf21-5bdad5335d84"",
    ""created_at"": ""2015-05-19T15:27:21+00:00"",
    ""updated_at"": ""2015-05-19T15:27:21+00:00""
  },
  ""entity"": {
    ""name"": ""name_1"",
    ""position"": 3,
    ""enabled"": true,
    ""locked"": false,
    ""filename"": ""name-1689""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid? guid = Guid.NewGuid();

                ChangePositionOfBuildpackRequest value = new ChangePositionOfBuildpackRequest();


                var obj = cfClient.Buildpacks.ChangePositionOfBuildpack(guid, value).Result;


                Assert.AreEqual("c428eba4-dbc5-4034-bf21-5bdad5335d84", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/buildpacks/c428eba4-dbc5-4034-bf21-5bdad5335d84", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2015-05-19T15:27:21+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("2015-05-19T15:27:21+00:00", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("name_1", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("3", TestUtil.ToTestableString(obj.Position), true);
                Assert.AreEqual("true", TestUtil.ToTestableString(obj.Enabled), true);
                Assert.AreEqual("false", TestUtil.ToTestableString(obj.Locked), true);
                Assert.AreEqual("name-1689", TestUtil.ToTestableString(obj.Filename), true);

            }
        }
        public void FilterSharedDomainsByNameTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""total_results"": 1,
  ""total_pages"": 1,
  ""prev_url"": null,
  ""next_url"": null,
  ""resources"": [
    {
      ""metadata"": {
        ""guid"": ""e893db12-d8e7-49b6-8ba9-4d6437317035"",
        ""url"": ""/v2/shared_domains/e893db12-d8e7-49b6-8ba9-4d6437317035"",
        ""created_at"": ""2015-05-19T15:27:03+00:00"",
        ""updated_at"": null
      },
      ""entity"": {
        ""name"": ""shared-domain.com""
      }
    }
  ]
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();


                var obj = cfClient.SharedDomains.FilterSharedDomainsByName().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("e893db12-d8e7-49b6-8ba9-4d6437317035", TestUtil.ToTestableString(obj[0].EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/shared_domains/e893db12-d8e7-49b6-8ba9-4d6437317035", TestUtil.ToTestableString(obj[0].EntityMetadata.Url), true);
                Assert.AreEqual("2015-05-19T15:27:03+00:00", TestUtil.ToTestableString(obj[0].EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj[0].EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("shared-domain.com", TestUtil.ToTestableString(obj[0].Name), true);

            }
        }
        public void UpdateServiceBrokerTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""7553ea4c-d05f-445c-bcc3-77748f5568a4"",
    ""created_at"": ""2015-05-19T15:27:09+00:00"",
    ""updated_at"": ""2015-05-19T15:27:09+00:00"",
    ""url"": ""/v2/service_brokers/7553ea4c-d05f-445c-bcc3-77748f5568a4""
  },
  ""entity"": {
    ""name"": ""name-485"",
    ""broker_url"": ""https://mybroker.example.com"",
    ""auth_username"": ""admin-user""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid? guid = Guid.NewGuid();

                UpdateServiceBrokerRequest value = new UpdateServiceBrokerRequest();


                var obj = cfClient.ServiceBrokers.UpdateServiceBroker(guid, value).Result;


                Assert.AreEqual("7553ea4c-d05f-445c-bcc3-77748f5568a4", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("2015-05-19T15:27:09+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("2015-05-19T15:27:09+00:00", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("/v2/service_brokers/7553ea4c-d05f-445c-bcc3-77748f5568a4", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("name-485", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("https://mybroker.example.com", TestUtil.ToTestableString(obj.BrokerUrl), true);
                Assert.AreEqual("admin-user", TestUtil.ToTestableString(obj.AuthUsername), true);

            }
        }
Beispiel #19
0
        public void RetrieveFileTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                clients.ExpectedStatusCode = (HttpStatusCode)302;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid? app_guid = Guid.NewGuid();

                int? instance_index = 0;

                dynamic file_path = null;


                cfClient.Files.RetrieveFile(app_guid, instance_index, file_path).Wait();

            }
        }
Beispiel #20
0
        public void CreatesDomainOwnedByGivenOrganizationDeprecatedTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""ec4741e3-3288-4046-810d-d8f72144e558"",
    ""url"": ""/v2/domains/ec4741e3-3288-4046-810d-d8f72144e558"",
    ""created_at"": ""2015-04-16T12:04:24+00:00"",
    ""updated_at"": null
  },
  ""entity"": {
    ""name"": ""exmaple.com"",
    ""owning_organization_guid"": ""04638947-e98f-413d-b6a9-64259b0c43b0"",
    ""owning_organization_url"": ""/v2/organizations/04638947-e98f-413d-b6a9-64259b0c43b0"",
    ""spaces_url"": ""/v2/domains/ec4741e3-3288-4046-810d-d8f72144e558/spaces""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                CreatesDomainOwnedByGivenOrganizationDeprecatedRequest value = new CreatesDomainOwnedByGivenOrganizationDeprecatedRequest();


                var obj = cfClient.DomainsDeprecated.CreatesDomainOwnedByGivenOrganizationDeprecated(value).Result;


                Assert.AreEqual("ec4741e3-3288-4046-810d-d8f72144e558", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/domains/ec4741e3-3288-4046-810d-d8f72144e558", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2015-04-16T12:04:24+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("exmaple.com", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("04638947-e98f-413d-b6a9-64259b0c43b0", TestUtil.ToTestableString(obj.OwningOrganizationGuid), true);
                Assert.AreEqual("/v2/organizations/04638947-e98f-413d-b6a9-64259b0c43b0", TestUtil.ToTestableString(obj.OwningOrganizationUrl), true);
                Assert.AreEqual("/v2/domains/ec4741e3-3288-4046-810d-d8f72144e558/spaces", TestUtil.ToTestableString(obj.SpacesUrl), true);
            }
        }
Beispiel #21
0
        public void CreatePrivateDomainOwnedByGivenOrganizationTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""5741faeb-cf7d-4735-afc6-f969dec1dae9"",
    ""url"": ""/v2/private_domains/5741faeb-cf7d-4735-afc6-f969dec1dae9"",
    ""created_at"": ""2016-02-09T10:21:56Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""name"": ""exmaple.com"",
    ""owning_organization_guid"": ""26617dad-a614-4c3d-baf7-e0785b9b58e0"",
    ""owning_organization_url"": ""/v2/organizations/26617dad-a614-4c3d-baf7-e0785b9b58e0"",
    ""shared_organizations_url"": ""/v2/private_domains/5741faeb-cf7d-4735-afc6-f969dec1dae9/shared_organizations""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                CreatePrivateDomainOwnedByGivenOrganizationRequest value = new CreatePrivateDomainOwnedByGivenOrganizationRequest();


                var obj = cfClient.PrivateDomains.CreatePrivateDomainOwnedByGivenOrganization(value).Result;


                Assert.AreEqual("5741faeb-cf7d-4735-afc6-f969dec1dae9", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/private_domains/5741faeb-cf7d-4735-afc6-f969dec1dae9", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-02-09T10:21:56Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("exmaple.com", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("26617dad-a614-4c3d-baf7-e0785b9b58e0", TestUtil.ToTestableString(obj.OwningOrganizationGuid), true);
                Assert.AreEqual("/v2/organizations/26617dad-a614-4c3d-baf7-e0785b9b58e0", TestUtil.ToTestableString(obj.OwningOrganizationUrl), true);
                Assert.AreEqual("/v2/private_domains/5741faeb-cf7d-4735-afc6-f969dec1dae9/shared_organizations", TestUtil.ToTestableString(obj.SharedOrganizationsUrl), true);
            }
        }
Beispiel #22
0
        public void CreateServicePlanVisibilityTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""efa536a8-334b-4750-ba75-91958b2c469c"",
    ""url"": ""/v2/service_plan_visibilities/efa536a8-334b-4750-ba75-91958b2c469c"",
    ""created_at"": ""2015-04-16T12:04:22+00:00"",
    ""updated_at"": null
  },
  ""entity"": {
    ""service_plan_guid"": ""bdc11465-2a7b-49da-94b9-867ffdeecf02"",
    ""organization_guid"": ""cef3c47c-8cfe-4e34-8463-de01ad657e43"",
    ""service_plan_url"": ""/v2/service_plans/bdc11465-2a7b-49da-94b9-867ffdeecf02"",
    ""organization_url"": ""/v2/organizations/cef3c47c-8cfe-4e34-8463-de01ad657e43""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                CreateServicePlanVisibilityRequest value = new CreateServicePlanVisibilityRequest();


                var obj = cfClient.ServicePlanVisibilities.CreateServicePlanVisibility(value).Result;


                Assert.AreEqual("efa536a8-334b-4750-ba75-91958b2c469c", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/service_plan_visibilities/efa536a8-334b-4750-ba75-91958b2c469c", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2015-04-16T12:04:22+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("bdc11465-2a7b-49da-94b9-867ffdeecf02", TestUtil.ToTestableString(obj.ServicePlanGuid), true);
                Assert.AreEqual("cef3c47c-8cfe-4e34-8463-de01ad657e43", TestUtil.ToTestableString(obj.OrganizationGuid), true);
                Assert.AreEqual("/v2/service_plans/bdc11465-2a7b-49da-94b9-867ffdeecf02", TestUtil.ToTestableString(obj.ServicePlanUrl), true);
                Assert.AreEqual("/v2/organizations/cef3c47c-8cfe-4e34-8463-de01ad657e43", TestUtil.ToTestableString(obj.OrganizationUrl), true);
            }
        }
Beispiel #23
0
        public void RetrieveServicePlanVisibilityTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""94008955-73c1-4266-963a-31b1c8fa8f33"",
    ""url"": ""/v2/service_plan_visibilities/94008955-73c1-4266-963a-31b1c8fa8f33"",
    ""created_at"": ""2015-04-16T12:04:22+00:00"",
    ""updated_at"": null
  },
  ""entity"": {
    ""service_plan_guid"": ""8bf8aca3-93fb-4b8c-bc11-2160db19ea19"",
    ""organization_guid"": ""d4d63a84-8633-436a-a0f5-3091e0a23347"",
    ""service_plan_url"": ""/v2/service_plans/8bf8aca3-93fb-4b8c-bc11-2160db19ea19"",
    ""organization_url"": ""/v2/organizations/d4d63a84-8633-436a-a0f5-3091e0a23347""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid?guid = Guid.NewGuid();


                var obj = cfClient.ServicePlanVisibilities.RetrieveServicePlanVisibility(guid).Result;


                Assert.AreEqual("94008955-73c1-4266-963a-31b1c8fa8f33", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/service_plan_visibilities/94008955-73c1-4266-963a-31b1c8fa8f33", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2015-04-16T12:04:22+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("8bf8aca3-93fb-4b8c-bc11-2160db19ea19", TestUtil.ToTestableString(obj.ServicePlanGuid), true);
                Assert.AreEqual("d4d63a84-8633-436a-a0f5-3091e0a23347", TestUtil.ToTestableString(obj.OrganizationGuid), true);
                Assert.AreEqual("/v2/service_plans/8bf8aca3-93fb-4b8c-bc11-2160db19ea19", TestUtil.ToTestableString(obj.ServicePlanUrl), true);
                Assert.AreEqual("/v2/organizations/d4d63a84-8633-436a-a0f5-3091e0a23347", TestUtil.ToTestableString(obj.OrganizationUrl), true);
            }
        }
Beispiel #24
0
        public void RetrieveServiceBrokerTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""d403e1b4-878b-463f-8918-ff2d23e8deea"",
    ""url"": ""/v2/service_brokers/432bf0dc-7b26-43e7-8034-fb5982f243dc"",
    ""created_at"": ""2016-09-02T11:52:08Z"",
    ""updated_at"": ""2016-09-02T11:52:08Z""
  },
  ""entity"": {
    ""name"": ""name-711"",
    ""broker_url"": ""https://foo.com/url-29"",
    ""auth_username"": ""auth_username-25"",
    ""space_guid"": ""d403e1b4-878b-463f-8918-ff2d23e8deea""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid?guid = Guid.NewGuid();


                var obj = cfClient.ServiceBrokers.RetrieveServiceBroker(guid).Result;


                Assert.AreEqual("d403e1b4-878b-463f-8918-ff2d23e8deea", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/service_brokers/432bf0dc-7b26-43e7-8034-fb5982f243dc", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-09-02T11:52:08Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("2016-09-02T11:52:08Z", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("name-711", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("https://foo.com/url-29", TestUtil.ToTestableString(obj.BrokerUrl), true);
                Assert.AreEqual("auth_username-25", TestUtil.ToTestableString(obj.AuthUsername), true);
                Assert.AreEqual("d403e1b4-878b-463f-8918-ff2d23e8deea", TestUtil.ToTestableString(obj.SpaceGuid), true);
            }
        }
Beispiel #25
0
        public void UpdateServiceBrokerTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""e9de2dc8-6735-4d82-b976-7c3770146a98"",
    ""created_at"": ""2016-02-09T10:21:41Z"",
    ""updated_at"": ""2016-02-09T10:21:41Z"",
    ""url"": ""/v2/service_brokers/e9de2dc8-6735-4d82-b976-7c3770146a98""
  },
  ""entity"": {
    ""name"": ""name-13"",
    ""broker_url"": ""https://mybroker.example.com"",
    ""auth_username"": ""admin-user""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid?guid = Guid.NewGuid();

                UpdateServiceBrokerRequest value = new UpdateServiceBrokerRequest();


                var obj = cfClient.ServiceBrokers.UpdateServiceBroker(guid, value).Result;


                Assert.AreEqual("e9de2dc8-6735-4d82-b976-7c3770146a98", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("2016-02-09T10:21:41Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("2016-02-09T10:21:41Z", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("/v2/service_brokers/e9de2dc8-6735-4d82-b976-7c3770146a98", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("name-13", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("https://mybroker.example.com", TestUtil.ToTestableString(obj.BrokerUrl), true);
                Assert.AreEqual("admin-user", TestUtil.ToTestableString(obj.AuthUsername), true);
            }
        }
Beispiel #26
0
        public void RetrievePrivateDomainTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""0092b149-ca9d-4e2c-9f36-eab07b08a6d5"",
    ""url"": ""/v2/private_domains/0092b149-ca9d-4e2c-9f36-eab07b08a6d5"",
    ""created_at"": ""2016-02-09T10:21:53Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""name"": ""vcap.me"",
    ""owning_organization_guid"": ""21b05e41-2a93-45aa-8b06-b5512532a29a"",
    ""owning_organization_url"": ""/v2/organizations/21b05e41-2a93-45aa-8b06-b5512532a29a"",
    ""shared_organizations_url"": ""/v2/private_domains/0092b149-ca9d-4e2c-9f36-eab07b08a6d5/shared_organizations""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid?guid = Guid.NewGuid();


                var obj = cfClient.PrivateDomains.RetrievePrivateDomain(guid).Result;


                Assert.AreEqual("0092b149-ca9d-4e2c-9f36-eab07b08a6d5", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/private_domains/0092b149-ca9d-4e2c-9f36-eab07b08a6d5", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-02-09T10:21:53Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("vcap.me", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("21b05e41-2a93-45aa-8b06-b5512532a29a", TestUtil.ToTestableString(obj.OwningOrganizationGuid), true);
                Assert.AreEqual("/v2/organizations/21b05e41-2a93-45aa-8b06-b5512532a29a", TestUtil.ToTestableString(obj.OwningOrganizationUrl), true);
                Assert.AreEqual("/v2/private_domains/0092b149-ca9d-4e2c-9f36-eab07b08a6d5/shared_organizations", TestUtil.ToTestableString(obj.SharedOrganizationsUrl), true);
            }
        }
Beispiel #27
0
        public void CreateServiceBrokerTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""a703b5e8-9adf-4261-a42d-5f2970f433fb"",
    ""created_at"": ""2016-09-02T11:52:09Z"",
    ""updated_at"": null,
    ""url"": ""/v2/service_brokers/f9f5f5f5-70cc-4ad0-aec7-623859a211a2""
  },
  ""entity"": {
    ""name"": ""service-broker-name"",
    ""broker_url"": ""https://broker.example.com"",
    ""auth_username"": ""admin"",
    ""space_guid"": null
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                CreateServiceBrokerRequest value = new CreateServiceBrokerRequest();


                var obj = cfClient.ServiceBrokers.CreateServiceBroker(value).Result;


                Assert.AreEqual("a703b5e8-9adf-4261-a42d-5f2970f433fb", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("2016-09-02T11:52:09Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("/v2/service_brokers/f9f5f5f5-70cc-4ad0-aec7-623859a211a2", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("service-broker-name", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("https://broker.example.com", TestUtil.ToTestableString(obj.BrokerUrl), true);
                Assert.AreEqual("admin", TestUtil.ToTestableString(obj.AuthUsername), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.SpaceGuid), true);
            }
        }
Beispiel #28
0
        public void CreatePrivateDomainOwnedByGivenOrganizationTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""048a0883-3d0c-4cfc-92c8-ea39829e1ff8"",
    ""url"": ""/v2/private_domains/2442c2e5-29cb-4c9a-a0ca-ab217b196dfd"",
    ""created_at"": ""2016-09-02T11:52:06Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""name"": ""exmaple.com"",
    ""owning_organization_guid"": ""048a0883-3d0c-4cfc-92c8-ea39829e1ff8"",
    ""owning_organization_url"": ""/v2/organizations/c992ca31-d152-447a-b916-3ee9fc63c0cd"",
    ""shared_organizations_url"": ""/v2/private_domains/2442c2e5-29cb-4c9a-a0ca-ab217b196dfd/shared_organizations""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                CreatePrivateDomainOwnedByGivenOrganizationRequest value = new CreatePrivateDomainOwnedByGivenOrganizationRequest();


                var obj = cfClient.PrivateDomains.CreatePrivateDomainOwnedByGivenOrganization(value).Result;


                Assert.AreEqual("048a0883-3d0c-4cfc-92c8-ea39829e1ff8", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/private_domains/2442c2e5-29cb-4c9a-a0ca-ab217b196dfd", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-09-02T11:52:06Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("exmaple.com", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("048a0883-3d0c-4cfc-92c8-ea39829e1ff8", TestUtil.ToTestableString(obj.OwningOrganizationGuid), true);
                Assert.AreEqual("/v2/organizations/c992ca31-d152-447a-b916-3ee9fc63c0cd", TestUtil.ToTestableString(obj.OwningOrganizationUrl), true);
                Assert.AreEqual("/v2/private_domains/2442c2e5-29cb-4c9a-a0ca-ab217b196dfd/shared_organizations", TestUtil.ToTestableString(obj.SharedOrganizationsUrl), true);
            }
        }
Beispiel #29
0
        public void CreateServicePlanVisibilityTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""cedb1495-8e10-4d95-af08-de6f50e4c89a"",
    ""url"": ""/v2/service_plan_visibilities/cedb1495-8e10-4d95-af08-de6f50e4c89a"",
    ""created_at"": ""2016-02-09T10:21:53Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""service_plan_guid"": ""3f0c3f84-ed58-485e-ad2c-6702241de1ed"",
    ""organization_guid"": ""b9a0eecd-f62f-4efd-8a1e-0357a60d290b"",
    ""service_plan_url"": ""/v2/service_plans/3f0c3f84-ed58-485e-ad2c-6702241de1ed"",
    ""organization_url"": ""/v2/organizations/b9a0eecd-f62f-4efd-8a1e-0357a60d290b""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                CreateServicePlanVisibilityRequest value = new CreateServicePlanVisibilityRequest();


                var obj = cfClient.ServicePlanVisibilities.CreateServicePlanVisibility(value).Result;


                Assert.AreEqual("cedb1495-8e10-4d95-af08-de6f50e4c89a", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/service_plan_visibilities/cedb1495-8e10-4d95-af08-de6f50e4c89a", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-02-09T10:21:53Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("3f0c3f84-ed58-485e-ad2c-6702241de1ed", TestUtil.ToTestableString(obj.ServicePlanGuid), true);
                Assert.AreEqual("b9a0eecd-f62f-4efd-8a1e-0357a60d290b", TestUtil.ToTestableString(obj.OrganizationGuid), true);
                Assert.AreEqual("/v2/service_plans/3f0c3f84-ed58-485e-ad2c-6702241de1ed", TestUtil.ToTestableString(obj.ServicePlanUrl), true);
                Assert.AreEqual("/v2/organizations/b9a0eecd-f62f-4efd-8a1e-0357a60d290b", TestUtil.ToTestableString(obj.OrganizationUrl), true);
            }
        }
        public void CreateDomainOwnedByGivenOrganizationDeprecatedTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""50a2b74b-0e68-4457-a161-e72cbe31966f"",
    ""url"": ""/v2/private_domains/23f96443-37c5-4f0b-8a63-0d787fca4151"",
    ""created_at"": ""2016-09-02T11:52:01Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""name"": ""exmaple.com"",
    ""owning_organization_guid"": ""50a2b74b-0e68-4457-a161-e72cbe31966f"",
    ""owning_organization_url"": ""/v2/organizations/0677eca7-81d0-411f-b5a9-6cf9d8b616dc"",
    ""spaces_url"": ""/v2/domains/23f96443-37c5-4f0b-8a63-0d787fca4151/spaces""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                CreateDomainOwnedByGivenOrganizationDeprecatedRequest value = new CreateDomainOwnedByGivenOrganizationDeprecatedRequest();


                var obj = cfClient.DomainsDeprecated.CreateDomainOwnedByGivenOrganizationDeprecated(value).Result;


                Assert.AreEqual("50a2b74b-0e68-4457-a161-e72cbe31966f", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/private_domains/23f96443-37c5-4f0b-8a63-0d787fca4151", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-09-02T11:52:01Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("exmaple.com", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("50a2b74b-0e68-4457-a161-e72cbe31966f", TestUtil.ToTestableString(obj.OwningOrganizationGuid), true);
                Assert.AreEqual("/v2/organizations/0677eca7-81d0-411f-b5a9-6cf9d8b616dc", TestUtil.ToTestableString(obj.OwningOrganizationUrl), true);
                Assert.AreEqual("/v2/domains/23f96443-37c5-4f0b-8a63-0d787fca4151/spaces", TestUtil.ToTestableString(obj.SpacesUrl), true);
            }
        }
Beispiel #31
0
        public void RetrieveServicePlanVisibilityTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""779b1386-2552-4689-91c6-92ce8e358c10"",
    ""url"": ""/v2/service_plan_visibilities/779b1386-2552-4689-91c6-92ce8e358c10"",
    ""created_at"": ""2016-02-09T10:21:53Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""service_plan_guid"": ""31dca120-ae87-477a-b1f0-106d21f7b1df"",
    ""organization_guid"": ""ebc51f4a-1589-451a-84ca-02a0c74a2232"",
    ""service_plan_url"": ""/v2/service_plans/31dca120-ae87-477a-b1f0-106d21f7b1df"",
    ""organization_url"": ""/v2/organizations/ebc51f4a-1589-451a-84ca-02a0c74a2232""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid?guid = Guid.NewGuid();


                var obj = cfClient.ServicePlanVisibilities.RetrieveServicePlanVisibility(guid).Result;


                Assert.AreEqual("779b1386-2552-4689-91c6-92ce8e358c10", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/service_plan_visibilities/779b1386-2552-4689-91c6-92ce8e358c10", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-02-09T10:21:53Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("31dca120-ae87-477a-b1f0-106d21f7b1df", TestUtil.ToTestableString(obj.ServicePlanGuid), true);
                Assert.AreEqual("ebc51f4a-1589-451a-84ca-02a0c74a2232", TestUtil.ToTestableString(obj.OrganizationGuid), true);
                Assert.AreEqual("/v2/service_plans/31dca120-ae87-477a-b1f0-106d21f7b1df", TestUtil.ToTestableString(obj.ServicePlanUrl), true);
                Assert.AreEqual("/v2/organizations/ebc51f4a-1589-451a-84ca-02a0c74a2232", TestUtil.ToTestableString(obj.OrganizationUrl), true);
            }
        }
Beispiel #32
0
        public void CreateServicePlanVisibilityTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""18d64ecd-66ab-4f90-9e82-7a9654ac6df6"",
    ""url"": ""/v2/service_plan_visibilities/3650a05e-9554-4dc9-8a49-831f66fd58aa"",
    ""created_at"": ""2016-09-02T11:51:56Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""service_plan_guid"": ""18d64ecd-66ab-4f90-9e82-7a9654ac6df6"",
    ""organization_guid"": ""18d64ecd-66ab-4f90-9e82-7a9654ac6df6"",
    ""service_plan_url"": ""/v2/service_plans/4ad304fe-e98f-4731-9f94-4e05b93883fb"",
    ""organization_url"": ""/v2/organizations/62ac37bf-8386-40c0-8371-00e9c12ac888""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                CreateServicePlanVisibilityRequest value = new CreateServicePlanVisibilityRequest();


                var obj = cfClient.ServicePlanVisibilities.CreateServicePlanVisibility(value).Result;


                Assert.AreEqual("18d64ecd-66ab-4f90-9e82-7a9654ac6df6", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/service_plan_visibilities/3650a05e-9554-4dc9-8a49-831f66fd58aa", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-09-02T11:51:56Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("18d64ecd-66ab-4f90-9e82-7a9654ac6df6", TestUtil.ToTestableString(obj.ServicePlanGuid), true);
                Assert.AreEqual("18d64ecd-66ab-4f90-9e82-7a9654ac6df6", TestUtil.ToTestableString(obj.OrganizationGuid), true);
                Assert.AreEqual("/v2/service_plans/4ad304fe-e98f-4731-9f94-4e05b93883fb", TestUtil.ToTestableString(obj.ServicePlanUrl), true);
                Assert.AreEqual("/v2/organizations/62ac37bf-8386-40c0-8371-00e9c12ac888", TestUtil.ToTestableString(obj.OrganizationUrl), true);
            }
        }
Beispiel #33
0
        public void UpdateServiceBrokerTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""9542f26f-6ff0-4e80-9762-f0c5de64d650"",
    ""created_at"": ""2015-04-16T12:04:23+00:00"",
    ""updated_at"": ""2015-04-16T12:04:23+00:00"",
    ""url"": ""/v2/service_brokers/9542f26f-6ff0-4e80-9762-f0c5de64d650""
  },
  ""entity"": {
    ""name"": ""name-447"",
    ""broker_url"": ""https://mybroker.example.com"",
    ""auth_username"": ""admin-user""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid?guid = Guid.NewGuid();

                UpdateServiceBrokerRequest value = new UpdateServiceBrokerRequest();


                var obj = cfClient.ServiceBrokers.UpdateServiceBroker(guid, value).Result;


                Assert.AreEqual("9542f26f-6ff0-4e80-9762-f0c5de64d650", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("2015-04-16T12:04:23+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("2015-04-16T12:04:23+00:00", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("/v2/service_brokers/9542f26f-6ff0-4e80-9762-f0c5de64d650", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("name-447", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("https://mybroker.example.com", TestUtil.ToTestableString(obj.BrokerUrl), true);
                Assert.AreEqual("admin-user", TestUtil.ToTestableString(obj.AuthUsername), true);
            }
        }
Beispiel #34
0
        public void RetrieveServicePlanVisibilityTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""718d8463-e31b-44a9-bb1e-90eb8ab60817"",
    ""url"": ""/v2/service_plan_visibilities/1357102d-4e99-4935-a4e4-8baafe91ef28"",
    ""created_at"": ""2016-09-02T11:51:56Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""service_plan_guid"": ""718d8463-e31b-44a9-bb1e-90eb8ab60817"",
    ""organization_guid"": ""718d8463-e31b-44a9-bb1e-90eb8ab60817"",
    ""service_plan_url"": ""/v2/service_plans/e306865a-0c99-4612-981d-27b612ec39e7"",
    ""organization_url"": ""/v2/organizations/824d0bf3-8dad-407d-90c6-e29659f1ad75""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid?guid = Guid.NewGuid();


                var obj = cfClient.ServicePlanVisibilities.RetrieveServicePlanVisibility(guid).Result;


                Assert.AreEqual("718d8463-e31b-44a9-bb1e-90eb8ab60817", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/service_plan_visibilities/1357102d-4e99-4935-a4e4-8baafe91ef28", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-09-02T11:51:56Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("718d8463-e31b-44a9-bb1e-90eb8ab60817", TestUtil.ToTestableString(obj.ServicePlanGuid), true);
                Assert.AreEqual("718d8463-e31b-44a9-bb1e-90eb8ab60817", TestUtil.ToTestableString(obj.OrganizationGuid), true);
                Assert.AreEqual("/v2/service_plans/e306865a-0c99-4612-981d-27b612ec39e7", TestUtil.ToTestableString(obj.ServicePlanUrl), true);
                Assert.AreEqual("/v2/organizations/824d0bf3-8dad-407d-90c6-e29659f1ad75", TestUtil.ToTestableString(obj.OrganizationUrl), true);
            }
        }
Beispiel #35
0
        public void RetrievingPermissionsOnServiceInstanceTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{""manage"":true}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid?guid = Guid.NewGuid();


                var obj = cfClient.ServiceInstances.RetrievingPermissionsOnServiceInstance(guid).Result;


                Assert.AreEqual("true", TestUtil.ToTestableString(obj.Manage), true);
            }
        }
Beispiel #36
0
        public void CheckRouteExistsTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                clients.ExpectedStatusCode = (HttpStatusCode)204;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid?domain_guid = Guid.NewGuid();

                dynamic host = null;

                dynamic path = null;

                dynamic port = null;


                cfClient.Routes.CheckRouteExists(domain_guid, host, path, port).Wait();
            }
        }
Beispiel #37
0
        public void CreatesSharedDomainDeprecatedTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""31a1d916-45d7-4592-8500-30e8cdf989a0"",
    ""url"": ""/v2/domains/31a1d916-45d7-4592-8500-30e8cdf989a0"",
    ""created_at"": ""2016-02-09T10:21:54Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""name"": ""example.com"",
    ""owning_organization_guid"": null,
    ""shared_organizations"": [

    ]
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                CreatesSharedDomainDeprecatedRequest value = new CreatesSharedDomainDeprecatedRequest();


                var obj = cfClient.DomainsDeprecated.CreatesSharedDomainDeprecated(value).Result;


                Assert.AreEqual("31a1d916-45d7-4592-8500-30e8cdf989a0", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/domains/31a1d916-45d7-4592-8500-30e8cdf989a0", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-02-09T10:21:54Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("example.com", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.OwningOrganizationGuid), true);
            }
        }
        public void CreateSharedDomainDeprecatedTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""1848288c-cce1-403c-864f-631165c71ab1"",
    ""url"": ""/v2/shared_domains/a6f6c169-568c-4d2a-8164-a5945154caf0"",
    ""created_at"": ""2016-09-02T11:52:01Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""name"": ""example.com"",
    ""router_group_guid"": null,
    ""router_group_type"": null
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                CreateSharedDomainDeprecatedRequest value = new CreateSharedDomainDeprecatedRequest();


                var obj = cfClient.DomainsDeprecated.CreateSharedDomainDeprecated(value).Result;


                Assert.AreEqual("1848288c-cce1-403c-864f-631165c71ab1", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/shared_domains/a6f6c169-568c-4d2a-8164-a5945154caf0", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-09-02T11:52:01Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("example.com", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.RouterGroupGuid), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.RouterGroupType), true);
            }
        }
        public void RetrieveSharedDomainTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""62369967-6a2a-4881-85cf-4150b5189bd0"",
    ""url"": ""/v2/shared_domains/ebc60470-1d5f-4bde-a8c2-8a6daa408328"",
    ""created_at"": ""2016-09-02T11:52:15Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""name"": ""customer-app-domain1.com"",
    ""router_group_guid"": null,
    ""router_group_type"": null
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid?guid = Guid.NewGuid();


                var obj = cfClient.SharedDomains.RetrieveSharedDomain(guid).Result;


                Assert.AreEqual("62369967-6a2a-4881-85cf-4150b5189bd0", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/shared_domains/ebc60470-1d5f-4bde-a8c2-8a6daa408328", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-09-02T11:52:15Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("customer-app-domain1.com", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.RouterGroupGuid), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.RouterGroupType), true);
            }
        }
Beispiel #40
0
        public void ListAllMatchingResourcesTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"[{""sha1"":""286e4d660a1c2d7b730d69e363db93fb515ef7f8"",""size"":36}]";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                ListAllMatchingResourcesRequest[] value = new ListAllMatchingResourcesRequest[0];


                var obj = cfClient.ResourceMatch.ListAllMatchingResources(value).Result;


                Assert.AreEqual("286e4d660a1c2d7b730d69e363db93fb515ef7f8", TestUtil.ToTestableString(obj[0].Sha1), true);
                Assert.AreEqual("36", TestUtil.ToTestableString(obj[0].Size), true);
            }
        }
Beispiel #41
0
        public void RetrieveServiceBrokerTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""85aa4724-7029-4c09-aea2-b56ccf1f299e"",
    ""url"": ""/v2/service_brokers/85aa4724-7029-4c09-aea2-b56ccf1f299e"",
    ""created_at"": ""2016-02-09T10:21:41Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""name"": ""name-7"",
    ""broker_url"": ""https://foo.com/url-1"",
    ""auth_username"": ""auth_username-1""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid?guid = Guid.NewGuid();


                var obj = cfClient.ServiceBrokers.RetrieveServiceBroker(guid).Result;


                Assert.AreEqual("85aa4724-7029-4c09-aea2-b56ccf1f299e", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/service_brokers/85aa4724-7029-4c09-aea2-b56ccf1f299e", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-02-09T10:21:41Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("name-7", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("https://foo.com/url-1", TestUtil.ToTestableString(obj.BrokerUrl), true);
                Assert.AreEqual("auth_username-1", TestUtil.ToTestableString(obj.AuthUsername), true);
            }
        }
Beispiel #42
0
        public void ListAllMatchingResourcesTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"[{""sha1"":""44e106ddccb33b7ad4bb1c888d8921e8931d2734"",""size"":36}]";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                ListAllMatchingResourcesRequest[] value = new ListAllMatchingResourcesRequest[0];


                var obj = cfClient.ResourceMatch.ListAllMatchingResources(value).Result;


                Assert.AreEqual("44e106ddccb33b7ad4bb1c888d8921e8931d2734", TestUtil.ToTestableString(obj[0].Sha1), true);
                Assert.AreEqual("36", TestUtil.ToTestableString(obj[0].Size), true);
            }
        }
Beispiel #43
0
        public void CreateServiceBrokerTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""264acd8b-2757-4e54-abfa-2c01a71c7b2c"",
    ""created_at"": ""2016-02-09T10:21:41Z"",
    ""updated_at"": null,
    ""url"": ""/v2/service_brokers/264acd8b-2757-4e54-abfa-2c01a71c7b2c""
  },
  ""entity"": {
    ""name"": ""service-broker-name"",
    ""broker_url"": ""https://broker.example.com"",
    ""auth_username"": ""admin""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                CreateServiceBrokerRequest value = new CreateServiceBrokerRequest();


                var obj = cfClient.ServiceBrokers.CreateServiceBroker(value).Result;


                Assert.AreEqual("264acd8b-2757-4e54-abfa-2c01a71c7b2c", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("2016-02-09T10:21:41Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("/v2/service_brokers/264acd8b-2757-4e54-abfa-2c01a71c7b2c", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("service-broker-name", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("https://broker.example.com", TestUtil.ToTestableString(obj.BrokerUrl), true);
                Assert.AreEqual("admin", TestUtil.ToTestableString(obj.AuthUsername), true);
            }
        }
        public void RetrieveDomainDeprecatedTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""919fc6bd-672b-4aa7-a109-629e437f642e"",
    ""url"": ""/v2/shared_domains/558d9609-f829-4ae3-b20f-7f6a2bc3ba83"",
    ""created_at"": ""2016-09-02T11:52:00Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""name"": ""domain-8.example.com"",
    ""router_group_guid"": null,
    ""router_group_type"": null
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid?guid = Guid.NewGuid();


                var obj = cfClient.DomainsDeprecated.RetrieveDomainDeprecated(guid).Result;


                Assert.AreEqual("919fc6bd-672b-4aa7-a109-629e437f642e", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/shared_domains/558d9609-f829-4ae3-b20f-7f6a2bc3ba83", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-09-02T11:52:00Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("domain-8.example.com", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.RouterGroupGuid), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.RouterGroupType), true);
            }
        }
Beispiel #45
0
        public void RetrieveServiceBrokerTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""8692657a-cc26-4bed-a975-d7a5ab115db3"",
    ""url"": ""/v2/service_brokers/8692657a-cc26-4bed-a975-d7a5ab115db3"",
    ""created_at"": ""2015-04-16T12:04:23+00:00"",
    ""updated_at"": null
  },
  ""entity"": {
    ""name"": ""name-450"",
    ""broker_url"": ""https://foo.com/url-37"",
    ""auth_username"": ""auth_username-16""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid?guid = Guid.NewGuid();


                var obj = cfClient.ServiceBrokers.RetrieveServiceBroker(guid).Result;


                Assert.AreEqual("8692657a-cc26-4bed-a975-d7a5ab115db3", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/service_brokers/8692657a-cc26-4bed-a975-d7a5ab115db3", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2015-04-16T12:04:23+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("name-450", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("https://foo.com/url-37", TestUtil.ToTestableString(obj.BrokerUrl), true);
                Assert.AreEqual("auth_username-16", TestUtil.ToTestableString(obj.AuthUsername), true);
            }
        }
        public void CreateSharedDomainTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""5ab49251-e559-405a-8093-cf0b09c7a901"",
    ""url"": ""/v2/shared_domains/76e8f903-fe03-472f-94cc-32d885c70a91"",
    ""created_at"": ""2016-09-02T11:52:25Z"",
    ""updated_at"": null
  },
  ""entity"": {
    ""name"": ""example.com"",
    ""router_group_guid"": ""5ab49251-e559-405a-8093-cf0b09c7a901"",
    ""router_group_type"": ""tcp""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                CreateSharedDomainRequest value = new CreateSharedDomainRequest();


                var obj = cfClient.SharedDomains.CreateSharedDomain(value).Result;


                Assert.AreEqual("5ab49251-e559-405a-8093-cf0b09c7a901", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/shared_domains/76e8f903-fe03-472f-94cc-32d885c70a91", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2016-09-02T11:52:25Z", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("example.com", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("5ab49251-e559-405a-8093-cf0b09c7a901", TestUtil.ToTestableString(obj.RouterGroupGuid), true);
                Assert.AreEqual("tcp", TestUtil.ToTestableString(obj.RouterGroupType), true);
            }
        }
Beispiel #47
0
        public void RetrievePrivateDomainTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""face0158-42ca-4003-8a48-d1c56a793ac8"",
    ""url"": ""/v2/private_domains/face0158-42ca-4003-8a48-d1c56a793ac8"",
    ""created_at"": ""2015-04-16T12:04:14+00:00"",
    ""updated_at"": null
  },
  ""entity"": {
    ""name"": ""vcap.me"",
    ""owning_organization_guid"": ""68378f1b-b6b1-4b89-8614-ff80330b6ae0"",
    ""owning_organization_url"": ""/v2/organizations/68378f1b-b6b1-4b89-8614-ff80330b6ae0""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid?guid = Guid.NewGuid();


                var obj = cfClient.PrivateDomains.RetrievePrivateDomain(guid).Result;


                Assert.AreEqual("face0158-42ca-4003-8a48-d1c56a793ac8", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/private_domains/face0158-42ca-4003-8a48-d1c56a793ac8", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2015-04-16T12:04:14+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("vcap.me", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("68378f1b-b6b1-4b89-8614-ff80330b6ae0", TestUtil.ToTestableString(obj.OwningOrganizationGuid), true);
                Assert.AreEqual("/v2/organizations/68378f1b-b6b1-4b89-8614-ff80330b6ae0", TestUtil.ToTestableString(obj.OwningOrganizationUrl), true);
            }
        }
Beispiel #48
0
        public void CreatePrivateDomainOwnedByGivenOrganizationTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""aadbdf75-19ef-4040-969a-63ca474f82e3"",
    ""url"": ""/v2/private_domains/aadbdf75-19ef-4040-969a-63ca474f82e3"",
    ""created_at"": ""2015-04-16T12:04:23+00:00"",
    ""updated_at"": null
  },
  ""entity"": {
    ""name"": ""exmaple.com"",
    ""owning_organization_guid"": ""6fc8d52b-8ba9-4c93-9973-44b18e04d6ec"",
    ""owning_organization_url"": ""/v2/organizations/6fc8d52b-8ba9-4c93-9973-44b18e04d6ec""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                CreatePrivateDomainOwnedByGivenOrganizationRequest value = new CreatePrivateDomainOwnedByGivenOrganizationRequest();


                var obj = cfClient.PrivateDomains.CreatePrivateDomainOwnedByGivenOrganization(value).Result;


                Assert.AreEqual("aadbdf75-19ef-4040-969a-63ca474f82e3", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/private_domains/aadbdf75-19ef-4040-969a-63ca474f82e3", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2015-04-16T12:04:23+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("exmaple.com", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("6fc8d52b-8ba9-4c93-9973-44b18e04d6ec", TestUtil.ToTestableString(obj.OwningOrganizationGuid), true);
                Assert.AreEqual("/v2/organizations/6fc8d52b-8ba9-4c93-9973-44b18e04d6ec", TestUtil.ToTestableString(obj.OwningOrganizationUrl), true);
            }
        }
Beispiel #49
0
        public void CreateServiceBrokerTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""816f33f3-dd5c-4207-9e57-cfabe8be61cf"",
    ""created_at"": ""2015-04-16T12:04:23+00:00"",
    ""updated_at"": null,
    ""url"": ""/v2/service_brokers/816f33f3-dd5c-4207-9e57-cfabe8be61cf""
  },
  ""entity"": {
    ""name"": ""service-broker-name"",
    ""broker_url"": ""https://broker.example.com"",
    ""auth_username"": ""admin""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)201;
                var cfClient = clients.CreateCloudFoundryClient();

                CreateServiceBrokerRequest value = new CreateServiceBrokerRequest();


                var obj = cfClient.ServiceBrokers.CreateServiceBroker(value).Result;


                Assert.AreEqual("816f33f3-dd5c-4207-9e57-cfabe8be61cf", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("2015-04-16T12:04:23+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("/v2/service_brokers/816f33f3-dd5c-4207-9e57-cfabe8be61cf", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("service-broker-name", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("https://broker.example.com", TestUtil.ToTestableString(obj.BrokerUrl), true);
                Assert.AreEqual("admin", TestUtil.ToTestableString(obj.AuthUsername), true);
            }
        }
Beispiel #50
0
        public void RetrieveStackTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""dcac0ff5-b8d2-4b08-8171-23c514e9af99"",
    ""url"": ""/v2/stacks/dcac0ff5-b8d2-4b08-8171-23c514e9af99"",
    ""created_at"": ""2015-05-19T15:27:04+00:00"",
    ""updated_at"": null
  },
  ""entity"": {
    ""name"": ""lucid64"",
    ""description"": ""Ubuntu 10.04 on x86-64""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid? guid = Guid.NewGuid();


                var obj = cfClient.Stacks.RetrieveStack(guid).Result;


                Assert.AreEqual("dcac0ff5-b8d2-4b08-8171-23c514e9af99", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/stacks/dcac0ff5-b8d2-4b08-8171-23c514e9af99", 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("lucid64", TestUtil.ToTestableString(obj.Name), true);
                Assert.AreEqual("Ubuntu 10.04 on x86-64", TestUtil.ToTestableString(obj.Description), true);

            }
        }
        public void GettingContentsOfStagingEnvironmentVariableGroupTest()
        {
            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();


                var obj = cfClient.EnvironmentVariableGroups.GettingContentsOfStagingEnvironmentVariableGroup().Result;


                Assert.AreEqual("123", TestUtil.ToTestableString(obj.Abc), true);
                Assert.AreEqual("far-so-la-tee", TestUtil.ToTestableString(obj.Doreme), true);

            }
        }
Beispiel #52
0
        public void RetrieveJobThatWasSuccessfulTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""0"",
    ""created_at"": ""1970-01-01T00:00:00+00:00"",
    ""url"": ""/v2/jobs/0""
  },
  ""entity"": {
    ""guid"": ""0"",
    ""status"": ""finished""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid? guid = Guid.NewGuid();


                var obj = cfClient.Jobs.RetrieveJobThatWasSuccessful(guid).Result;


                Assert.AreEqual("0", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("1970-01-01T00:00:00+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("/v2/jobs/0", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("0", TestUtil.ToTestableString(obj.Guid), true);
                Assert.AreEqual("finished", TestUtil.ToTestableString(obj.Status), true);

            }
        }
Beispiel #53
0
        public void GetUserSummaryTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{""metadata"":{""guid"":""uaa-id-135"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""organizations"":[{""metadata"":{""guid"":""e1a15c7c-ec1c-4b6a-891b-f084c7374f15"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""name"":""name-568"",""billing_enabled"":false,""status"":""active"",""spaces"":[{""metadata"":{""guid"":""7397400b-3318-4bf1-a077-87505cf20047"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""name"":""name-570""}}],""quota_definition"":{""metadata"":{""guid"":""926d502d-8f6c-4433-b162-954057e07ca1"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""name"":""name-569"",""non_basic_services_allowed"":true,""total_services"":60,""memory_limit"":20480,""trial_db_allowed"":false}},""managers"":[{""metadata"":{""guid"":""uaa-id-135"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""admin"":false,""active"":false,""default_space_guid"":null}}]}}],""managed_organizations"":[{""metadata"":{""guid"":""e1a15c7c-ec1c-4b6a-891b-f084c7374f15"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""name"":""name-568"",""billing_enabled"":false,""status"":""active"",""spaces"":[{""metadata"":{""guid"":""7397400b-3318-4bf1-a077-87505cf20047"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""name"":""name-570""}}],""quota_definition"":{""metadata"":{""guid"":""926d502d-8f6c-4433-b162-954057e07ca1"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""name"":""name-569"",""non_basic_services_allowed"":true,""total_services"":60,""memory_limit"":20480,""trial_db_allowed"":false}},""managers"":[{""metadata"":{""guid"":""uaa-id-135"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""admin"":false,""active"":false,""default_space_guid"":null}}]}}],""billing_managed_organizations"":[{""metadata"":{""guid"":""e1a15c7c-ec1c-4b6a-891b-f084c7374f15"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""name"":""name-568"",""billing_enabled"":false,""status"":""active"",""spaces"":[{""metadata"":{""guid"":""7397400b-3318-4bf1-a077-87505cf20047"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""name"":""name-570""}}],""quota_definition"":{""metadata"":{""guid"":""926d502d-8f6c-4433-b162-954057e07ca1"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""name"":""name-569"",""non_basic_services_allowed"":true,""total_services"":60,""memory_limit"":20480,""trial_db_allowed"":false}},""managers"":[{""metadata"":{""guid"":""uaa-id-135"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""admin"":false,""active"":false,""default_space_guid"":null}}]}}],""audited_organizations"":[{""metadata"":{""guid"":""e1a15c7c-ec1c-4b6a-891b-f084c7374f15"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""name"":""name-568"",""billing_enabled"":false,""status"":""active"",""spaces"":[{""metadata"":{""guid"":""7397400b-3318-4bf1-a077-87505cf20047"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""name"":""name-570""}}],""quota_definition"":{""metadata"":{""guid"":""926d502d-8f6c-4433-b162-954057e07ca1"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""name"":""name-569"",""non_basic_services_allowed"":true,""total_services"":60,""memory_limit"":20480,""trial_db_allowed"":false}},""managers"":[{""metadata"":{""guid"":""uaa-id-135"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""admin"":false,""active"":false,""default_space_guid"":null}}]}}],""spaces"":[{""metadata"":{""guid"":""7397400b-3318-4bf1-a077-87505cf20047"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""name"":""name-570""}}],""managed_spaces"":[{""metadata"":{""guid"":""7397400b-3318-4bf1-a077-87505cf20047"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""name"":""name-570""}}],""audited_spaces"":[{""metadata"":{""guid"":""7397400b-3318-4bf1-a077-87505cf20047"",""created_at"":""2015-05-19T15:27:11+00:00"",""updated_at"":null},""entity"":{""name"":""name-570""}}]}}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid? guid = Guid.NewGuid();


                var obj = cfClient.Users.GetUserSummary(guid).Result;


                Assert.AreEqual("uaa-id-135", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("2015-05-19T15:27:11+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);

            }
        }
Beispiel #54
0
        public void ListAllStacksTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""total_results"": 3,
  ""total_pages"": 1,
  ""prev_url"": null,
  ""next_url"": null,
  ""resources"": [
    {
      ""metadata"": {
        ""guid"": ""dcac0ff5-b8d2-4b08-8171-23c514e9af99"",
        ""url"": ""/v2/stacks/dcac0ff5-b8d2-4b08-8171-23c514e9af99"",
        ""created_at"": ""2015-05-19T15:27:04+00:00"",
        ""updated_at"": null
      },
      ""entity"": {
        ""name"": ""lucid64"",
        ""description"": ""Ubuntu 10.04 on x86-64""
      }
    },
    {
      ""metadata"": {
        ""guid"": ""a22cb008-1cda-43c3-b7d1-e406088a2a09"",
        ""url"": ""/v2/stacks/a22cb008-1cda-43c3-b7d1-e406088a2a09"",
        ""created_at"": ""2015-05-19T15:27:04+00:00"",
        ""updated_at"": null
      },
      ""entity"": {
        ""name"": ""default-stack-name"",
        ""description"": ""default-stack-description""
      }
    },
    {
      ""metadata"": {
        ""guid"": ""1993a548-b97c-4311-86a7-eb7b091fa6d5"",
        ""url"": ""/v2/stacks/1993a548-b97c-4311-86a7-eb7b091fa6d5"",
        ""created_at"": ""2015-05-19T15:27:04+00:00"",
        ""updated_at"": null
      },
      ""entity"": {
        ""name"": ""cider"",
        ""description"": ""cider-description""
      }
    }
  ]
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();


                var obj = cfClient.Stacks.ListAllStacks().Result;

                Assert.AreEqual("3", 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("dcac0ff5-b8d2-4b08-8171-23c514e9af99", TestUtil.ToTestableString(obj[0].EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/stacks/dcac0ff5-b8d2-4b08-8171-23c514e9af99", TestUtil.ToTestableString(obj[0].EntityMetadata.Url), true);
                Assert.AreEqual("2015-05-19T15:27:04+00:00", TestUtil.ToTestableString(obj[0].EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj[0].EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("lucid64", TestUtil.ToTestableString(obj[0].Name), true);
                Assert.AreEqual("Ubuntu 10.04 on x86-64", TestUtil.ToTestableString(obj[0].Description), true);
                Assert.AreEqual("a22cb008-1cda-43c3-b7d1-e406088a2a09", TestUtil.ToTestableString(obj[1].EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/stacks/a22cb008-1cda-43c3-b7d1-e406088a2a09", TestUtil.ToTestableString(obj[1].EntityMetadata.Url), true);
                Assert.AreEqual("2015-05-19T15:27:04+00:00", TestUtil.ToTestableString(obj[1].EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj[1].EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("default-stack-name", TestUtil.ToTestableString(obj[1].Name), true);
                Assert.AreEqual("default-stack-description", TestUtil.ToTestableString(obj[1].Description), true);
                Assert.AreEqual("1993a548-b97c-4311-86a7-eb7b091fa6d5", TestUtil.ToTestableString(obj[2].EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/stacks/1993a548-b97c-4311-86a7-eb7b091fa6d5", TestUtil.ToTestableString(obj[2].EntityMetadata.Url), true);
                Assert.AreEqual("2015-05-19T15:27:04+00:00", TestUtil.ToTestableString(obj[2].EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj[2].EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("cider", TestUtil.ToTestableString(obj[2].Name), true);
                Assert.AreEqual("cider-description", TestUtil.ToTestableString(obj[2].Description), true);

            }
        }
        public void RetrieveAppUsageEventTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""a3117b8b-2d8a-4058-a57c-776d2942492b"",
    ""url"": ""/v2/app_usage_events/a3117b8b-2d8a-4058-a57c-776d2942492b"",
    ""created_at"": ""2015-05-19T15:27:25+00:00""
  },
  ""entity"": {
    ""state"": ""STARTED"",
    ""memory_in_mb_per_instance"": 564,
    ""instance_count"": 1,
    ""app_guid"": ""guid-6b12d06c-2697-42ff-a6e7-32b01f18b42f"",
    ""app_name"": ""name-1922"",
    ""space_guid"": ""guid-514023b8-bdb1-45eb-90c4-a615a722bb86"",
    ""space_name"": ""name-1923"",
    ""org_guid"": ""guid-58868a5c-0129-42d4-a0cd-84ba2df6df03"",
    ""buildpack_guid"": ""guid-4145677f-042e-4551-84d7-b27edfc2420a"",
    ""buildpack_name"": ""name-1924"",
    ""package_state"": ""STAGED""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid? guid = Guid.NewGuid();


                var obj = cfClient.AppUsageEvents.RetrieveAppUsageEvent(guid).Result;


                Assert.AreEqual("a3117b8b-2d8a-4058-a57c-776d2942492b", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/app_usage_events/a3117b8b-2d8a-4058-a57c-776d2942492b", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2015-05-19T15:27:25+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("STARTED", TestUtil.ToTestableString(obj.State), true);
                Assert.AreEqual("564", TestUtil.ToTestableString(obj.MemoryInMbPerInstance), true);
                Assert.AreEqual("1", TestUtil.ToTestableString(obj.InstanceCount), true);
                Assert.AreEqual("guid-6b12d06c-2697-42ff-a6e7-32b01f18b42f", TestUtil.ToTestableString(obj.AppGuid), true);
                Assert.AreEqual("name-1922", TestUtil.ToTestableString(obj.AppName), true);
                Assert.AreEqual("guid-514023b8-bdb1-45eb-90c4-a615a722bb86", TestUtil.ToTestableString(obj.SpaceGuid), true);
                Assert.AreEqual("name-1923", TestUtil.ToTestableString(obj.SpaceName), true);
                Assert.AreEqual("guid-58868a5c-0129-42d4-a0cd-84ba2df6df03", TestUtil.ToTestableString(obj.OrgGuid), true);
                Assert.AreEqual("guid-4145677f-042e-4551-84d7-b27edfc2420a", TestUtil.ToTestableString(obj.BuildpackGuid), true);
                Assert.AreEqual("name-1924", TestUtil.ToTestableString(obj.BuildpackName), true);
                Assert.AreEqual("STAGED", TestUtil.ToTestableString(obj.PackageState), true);

            }
        }
        public void ListAllAppUsageEventsTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""total_results"": 2,
  ""total_pages"": 2,
  ""prev_url"": null,
  ""next_url"": ""/v2/app_usage_events?after_guid=16ac0838-06b4-4b76-b33b-ae8fc8773dae=asc=2=1"",
  ""resources"": [
    {
      ""metadata"": {
        ""guid"": ""a6b9f650-9560-4f7a-b00b-6a7978699d1f"",
        ""url"": ""/v2/app_usage_events/a6b9f650-9560-4f7a-b00b-6a7978699d1f"",
        ""created_at"": ""2015-05-19T15:27:25+00:00""
      },
      ""entity"": {
        ""state"": ""STARTED"",
        ""memory_in_mb_per_instance"": 564,
        ""instance_count"": 1,
        ""app_guid"": ""guid-66e5815f-80b2-4603-947e-559e88ed8c43"",
        ""app_name"": ""name-1916"",
        ""space_guid"": ""guid-42a6a79d-831f-486c-b0c2-f4b97e8dec80"",
        ""space_name"": ""name-1917"",
        ""org_guid"": ""guid-dd072134-1fbe-41ed-9459-b296d9598572"",
        ""buildpack_guid"": ""guid-8ad410ae-09e5-4fb5-be41-1e7860168b96"",
        ""buildpack_name"": ""name-1918"",
        ""package_state"": ""STAGED""
      }
    }
  ]
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();


                var obj = cfClient.AppUsageEvents.ListAllAppUsageEvents().Result;

                Assert.AreEqual("2", TestUtil.ToTestableString(obj.Properties.TotalResults), true);
                Assert.AreEqual("2", TestUtil.ToTestableString(obj.Properties.TotalPages), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.Properties.PreviousUrl), true);
                Assert.AreEqual("/v2/app_usage_events?after_guid=16ac0838-06b4-4b76-b33b-ae8fc8773dae=asc=2=1", TestUtil.ToTestableString(obj.Properties.NextUrl), true);
                Assert.AreEqual("a6b9f650-9560-4f7a-b00b-6a7978699d1f", TestUtil.ToTestableString(obj[0].EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/app_usage_events/a6b9f650-9560-4f7a-b00b-6a7978699d1f", TestUtil.ToTestableString(obj[0].EntityMetadata.Url), true);
                Assert.AreEqual("2015-05-19T15:27:25+00:00", TestUtil.ToTestableString(obj[0].EntityMetadata.CreatedAt), true);
                Assert.AreEqual("STARTED", TestUtil.ToTestableString(obj[0].State), true);
                Assert.AreEqual("564", TestUtil.ToTestableString(obj[0].MemoryInMbPerInstance), true);
                Assert.AreEqual("1", TestUtil.ToTestableString(obj[0].InstanceCount), true);
                Assert.AreEqual("guid-66e5815f-80b2-4603-947e-559e88ed8c43", TestUtil.ToTestableString(obj[0].AppGuid), true);
                Assert.AreEqual("name-1916", TestUtil.ToTestableString(obj[0].AppName), true);
                Assert.AreEqual("guid-42a6a79d-831f-486c-b0c2-f4b97e8dec80", TestUtil.ToTestableString(obj[0].SpaceGuid), true);
                Assert.AreEqual("name-1917", TestUtil.ToTestableString(obj[0].SpaceName), true);
                Assert.AreEqual("guid-dd072134-1fbe-41ed-9459-b296d9598572", TestUtil.ToTestableString(obj[0].OrgGuid), true);
                Assert.AreEqual("guid-8ad410ae-09e5-4fb5-be41-1e7860168b96", TestUtil.ToTestableString(obj[0].BuildpackGuid), true);
                Assert.AreEqual("name-1918", TestUtil.ToTestableString(obj[0].BuildpackName), true);
                Assert.AreEqual("STAGED", TestUtil.ToTestableString(obj[0].PackageState), true);

            }
        }
        public void PurgeAndReseedAppUsageEventsTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                clients.ExpectedStatusCode = (HttpStatusCode)204;
                var cfClient = clients.CreateCloudFoundryClient();


                cfClient.AppUsageEvents.PurgeAndReseedAppUsageEvents().Wait();

            }
        }
        public void ListAllServiceAuthTokensDeprecatedTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""total_results"": 3,
  ""total_pages"": 1,
  ""prev_url"": null,
  ""next_url"": null,
  ""resources"": [
    {
      ""metadata"": {
        ""guid"": ""3a2145f0-08c5-4ac7-bb92-d85964664e26"",
        ""url"": ""/v2/service_auth_tokens/3a2145f0-08c5-4ac7-bb92-d85964664e26"",
        ""created_at"": ""2015-05-19T15:27:01+00:00"",
        ""updated_at"": null
      },
      ""entity"": {
        ""label"": ""label-14"",
        ""provider"": ""provider-14""
      }
    },
    {
      ""metadata"": {
        ""guid"": ""0700952f-4e78-4179-a70e-e2e2adc93374"",
        ""url"": ""/v2/service_auth_tokens/0700952f-4e78-4179-a70e-e2e2adc93374"",
        ""created_at"": ""2015-05-19T15:27:01+00:00"",
        ""updated_at"": null
      },
      ""entity"": {
        ""label"": ""label-15"",
        ""provider"": ""provider-15""
      }
    },
    {
      ""metadata"": {
        ""guid"": ""afb33f4b-8988-47c0-895d-1a844bd4b7a6"",
        ""url"": ""/v2/service_auth_tokens/afb33f4b-8988-47c0-895d-1a844bd4b7a6"",
        ""created_at"": ""2015-05-19T15:27:01+00:00"",
        ""updated_at"": null
      },
      ""entity"": {
        ""label"": ""label-16"",
        ""provider"": ""provider-16""
      }
    }
  ]
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();


                var obj = cfClient.ServiceAuthTokensDeprecated.ListAllServiceAuthTokensDeprecated().Result;

                Assert.AreEqual("3", 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("3a2145f0-08c5-4ac7-bb92-d85964664e26", TestUtil.ToTestableString(obj[0].EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/service_auth_tokens/3a2145f0-08c5-4ac7-bb92-d85964664e26", TestUtil.ToTestableString(obj[0].EntityMetadata.Url), true);
                Assert.AreEqual("2015-05-19T15:27:01+00:00", TestUtil.ToTestableString(obj[0].EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj[0].EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("label-14", TestUtil.ToTestableString(obj[0].Label), true);
                Assert.AreEqual("provider-14", TestUtil.ToTestableString(obj[0].Provider), true);
                Assert.AreEqual("0700952f-4e78-4179-a70e-e2e2adc93374", TestUtil.ToTestableString(obj[1].EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/service_auth_tokens/0700952f-4e78-4179-a70e-e2e2adc93374", TestUtil.ToTestableString(obj[1].EntityMetadata.Url), true);
                Assert.AreEqual("2015-05-19T15:27:01+00:00", TestUtil.ToTestableString(obj[1].EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj[1].EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("label-15", TestUtil.ToTestableString(obj[1].Label), true);
                Assert.AreEqual("provider-15", TestUtil.ToTestableString(obj[1].Provider), true);
                Assert.AreEqual("afb33f4b-8988-47c0-895d-1a844bd4b7a6", TestUtil.ToTestableString(obj[2].EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/service_auth_tokens/afb33f4b-8988-47c0-895d-1a844bd4b7a6", TestUtil.ToTestableString(obj[2].EntityMetadata.Url), true);
                Assert.AreEqual("2015-05-19T15:27:01+00:00", TestUtil.ToTestableString(obj[2].EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj[2].EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("label-16", TestUtil.ToTestableString(obj[2].Label), true);
                Assert.AreEqual("provider-16", TestUtil.ToTestableString(obj[2].Provider), true);

            }
        }
        public void FilterResultSetByProviderDeprecatedTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""total_results"": 1,
  ""total_pages"": 1,
  ""prev_url"": null,
  ""next_url"": null,
  ""resources"": [
    {
      ""metadata"": {
        ""guid"": ""640aab00-1cbc-40a9-860c-4067313c618b"",
        ""url"": ""/v2/service_auth_tokens/640aab00-1cbc-40a9-860c-4067313c618b"",
        ""created_at"": ""2015-05-19T15:27:01+00:00"",
        ""updated_at"": null
      },
      ""entity"": {
        ""label"": ""label-7"",
        ""provider"": ""Face-Offer""
      }
    }
  ]
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();


                var obj = cfClient.ServiceAuthTokensDeprecated.FilterResultSetByProviderDeprecated().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("640aab00-1cbc-40a9-860c-4067313c618b", TestUtil.ToTestableString(obj[0].EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/service_auth_tokens/640aab00-1cbc-40a9-860c-4067313c618b", TestUtil.ToTestableString(obj[0].EntityMetadata.Url), true);
                Assert.AreEqual("2015-05-19T15:27:01+00:00", TestUtil.ToTestableString(obj[0].EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj[0].EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("label-7", TestUtil.ToTestableString(obj[0].Label), true);
                Assert.AreEqual("Face-Offer", TestUtil.ToTestableString(obj[0].Provider), true);

            }
        }
        public void RetrieveServiceAuthTokenDeprecatedTest()
        {
            using (ShimsContext.Create())
            {
                MockClients clients = new MockClients();

                string json = @"{
  ""metadata"": {
    ""guid"": ""b4d346d8-7d28-42e0-94c5-fce6801b0f24"",
    ""url"": ""/v2/service_auth_tokens/b4d346d8-7d28-42e0-94c5-fce6801b0f24"",
    ""created_at"": ""2015-05-19T15:27:01+00:00"",
    ""updated_at"": null
  },
  ""entity"": {
    ""label"": ""label-1"",
    ""provider"": ""provider-1""
  }
}";
                clients.JsonResponse = json;

                clients.ExpectedStatusCode = (HttpStatusCode)200;
                var cfClient = clients.CreateCloudFoundryClient();

                Guid? guid = Guid.NewGuid();


                var obj = cfClient.ServiceAuthTokensDeprecated.RetrieveServiceAuthTokenDeprecated(guid).Result;


                Assert.AreEqual("b4d346d8-7d28-42e0-94c5-fce6801b0f24", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true);
                Assert.AreEqual("/v2/service_auth_tokens/b4d346d8-7d28-42e0-94c5-fce6801b0f24", TestUtil.ToTestableString(obj.EntityMetadata.Url), true);
                Assert.AreEqual("2015-05-19T15:27:01+00:00", TestUtil.ToTestableString(obj.EntityMetadata.CreatedAt), true);
                Assert.AreEqual("", TestUtil.ToTestableString(obj.EntityMetadata.UpdatedAt), true);
                Assert.AreEqual("label-1", TestUtil.ToTestableString(obj.Label), true);
                Assert.AreEqual("provider-1", TestUtil.ToTestableString(obj.Provider), true);

            }
        }