public void IfAServiceDoesNotExistsCatalogReturnsFalse()
 {
     var expectedEndpoint = new Uri("http://public.endpoint.org");
     var serviceDef = new OpenStackServiceDefinition("Test Service", "Test-Service",
         new List<OpenStackServiceEndpoint>()
         {
             new OpenStackServiceEndpoint(expectedEndpoint.ToString(), "some region", "1.0",
                 "http://www.someplace.com", "http://www.someplace.com")
         });
     var catalog = new OpenStackServiceCatalog { serviceDef };
     Assert.IsFalse(catalog.Exists("NOT IN CATALOG"));
 }
 public void CanGetServicesInRegion()
 {
     var expectedEndpoint = new Uri("http://public.endpoint.org");
     var serviceDef = new OpenStackServiceDefinition("Test Service", "Test-Service",
         new List<OpenStackServiceEndpoint>()
         {
             new OpenStackServiceEndpoint(expectedEndpoint.ToString(), "some region", "1.0",
                 "http://www.someplace.com", "http://www.someplace.com")
         });
     var catalog = new OpenStackServiceCatalog { serviceDef };
     var services = catalog.GetServicesInAvailabilityZone("some region").ToList();
     Assert.AreEqual(1,services.Count());
     Assert.AreEqual("Test Service",services.First().Name);
 }
 public void GettingServicesInRegionWhenNonExistReturnsAnEmptyCollection()
 {
     var expectedEndpoint = new Uri("http://public.endpoint.org");
     var serviceDef = new OpenStackServiceDefinition("Test Service", "Test-Service",
         new List<OpenStackServiceEndpoint>()
         {
             new OpenStackServiceEndpoint(expectedEndpoint.ToString(), "some region", "1.0",
                 "http://www.someplace.com", "http://www.someplace.com")
         });
     var catalog = new OpenStackServiceCatalog { serviceDef };
     var services = catalog.GetServicesInAvailabilityZone("some other region").ToList();
     Assert.AreEqual(0, services.Count());
 }
        public void CannotGetPublicEndpointForAServiceThatIsNotInTheRegion()
        {
            var serviceName = "Test Service";
            var expectedEndpoint = "http://public.endpoint.org";
            var serviceDef = new OpenStackServiceDefinition(serviceName, "Test-Service",
                new List<OpenStackServiceEndpoint>()
                {
                    new OpenStackServiceEndpoint(expectedEndpoint, "some region", "1.0",
                        "http://www.someplace.com", "http://www.someplace.com")
                });

            var catalog = new OpenStackServiceCatalog { serviceDef };
            catalog.GetPublicEndpoint(serviceName, "Not-in-catalog");
        }
        public void CanGetPublicEndpointForAService()
        {
            var serviceName = "Test Service";
            var regionName = "some region";
            var expectedEndpoint = "http://public.endpoint.org";
            var serviceDef = new OpenStackServiceDefinition(serviceName, "Test-Service",
                new List<OpenStackServiceEndpoint>()
                {
                    new OpenStackServiceEndpoint(expectedEndpoint, "some region", "1.0",
                        "http://www.someplace.com", "http://www.someplace.com")
                });

            var catalog = new OpenStackServiceCatalog { serviceDef };
            var endpoint = catalog.GetPublicEndpoint(serviceName, regionName);
            Assert.AreEqual(expectedEndpoint, endpoint);
        }