public void RouteTest() { //Arrange using (ShimsContext.Create()) { ListAllRoutesForSpaceResponse response = new ListAllRoutesForSpaceResponse() { Host = "testText" }; RetrieveDomainDeprecatedResponse domain = new RetrieveDomainDeprecatedResponse() { Name = "testName" }; PagedResponseCollection <ListAllAppsForRouteResponse> responseList = new PagedResponseCollection <ListAllAppsForRouteResponse>(); CloudFoundry.CloudController.V2.Client.Fakes.ShimPagedResponseCollection <ListAllAppsForRouteResponse> .AllInstances.ResourcesGet = FakeRespone; CloudFoundryClient client = new CloudFoundryClient(new Uri("http://api.test.xip.io"), new System.Threading.CancellationToken()); //Act Route route = new Route(response, domain, responseList, client); //Assert Assert.IsTrue(route.Text == "testText"); Assert.IsTrue(route.Domain == "testName"); Assert.IsTrue(route.Apps == "testApp"); Assert.IsNotNull(route.Icon); Assert.IsTrue(route.Actions.Count > 0); } }
public void TestRetrieveDomainDeprecatedResponse() { 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 } }"; RetrieveDomainDeprecatedResponse obj = Utilities.DeserializeJson <RetrieveDomainDeprecatedResponse>(json); 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); }
public Route(ListAllRoutesForSpaceResponse route, RetrieveDomainDeprecatedResponse domain, PagedResponseCollection <ListAllAppsForRouteResponse> routeApps, CloudFoundryClient client) : base(CloudItemType.Route) { this.client = client; this.route = route; this.domain = domain; this.routeApps = routeApps; }
public void TestRetrieveDomainDeprecatedResponse() { string json = @"{ ""metadata"": { ""guid"": ""391b3c51-cc5a-49b2-8594-deb08899ceaa"", ""url"": ""/v2/domains/391b3c51-cc5a-49b2-8594-deb08899ceaa"", ""created_at"": ""2015-04-16T12:04:24+00:00"", ""updated_at"": null }, ""entity"": { ""name"": ""domain-29.example.com"" } }"; RetrieveDomainDeprecatedResponse obj = Utilities.DeserializeJson <RetrieveDomainDeprecatedResponse>(json); Assert.AreEqual("391b3c51-cc5a-49b2-8594-deb08899ceaa", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true); Assert.AreEqual("/v2/domains/391b3c51-cc5a-49b2-8594-deb08899ceaa", 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("domain-29.example.com", TestUtil.ToTestableString(obj.Name), true); }
public void TestRetrieveDomainDeprecatedResponse() { string json = @"{ ""metadata"": { ""guid"": ""4450b499-db06-43e2-90cb-6bff1cb09efe"", ""url"": ""/v2/domains/4450b499-db06-43e2-90cb-6bff1cb09efe"", ""created_at"": ""2016-02-09T10:21:54Z"", ""updated_at"": null }, ""entity"": { ""name"": ""domain-35.example.com"" } }"; RetrieveDomainDeprecatedResponse obj = Utilities.DeserializeJson <RetrieveDomainDeprecatedResponse>(json); Assert.AreEqual("4450b499-db06-43e2-90cb-6bff1cb09efe", TestUtil.ToTestableString(obj.EntityMetadata.Guid), true); Assert.AreEqual("/v2/domains/4450b499-db06-43e2-90cb-6bff1cb09efe", 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("domain-35.example.com", TestUtil.ToTestableString(obj.Name), true); }