public void ResolvesService() { // Setup namespace and service for the test. var namespaceId = _fixture.RandomResourceId; var serviceId = _fixture.RandomResourceId; var endpointId = _fixture.RandomResourceId; _fixture.CreateNamespace(namespaceId); _fixture.CreateService(namespaceId, serviceId); _fixture.CreateEndpoint(namespaceId, serviceId, endpointId); // Run the sample code. var resolveServiceSample = new ResolveServiceSample(); var service = resolveServiceSample.ResolveService(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId); Assert.Contains(serviceId, service.Name); Assert.Contains(endpointId, service.Endpoints[0].Name); }
public void DeletesNamespace() { // Setup namespace for the test. var namespaceId = _fixture.RandomResourceId; _fixture.CreateNamespace(namespaceId); // Run the sample code. var deleteNamespaceSample = new DeleteNamespaceSample(); deleteNamespaceSample.DeleteNamespace(_fixture.ProjectId, _fixture.LocationId, namespaceId); // Try to get the namespace. RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create(); var namespaceName = NamespaceName.FromProjectLocationNamespace(_fixture.ProjectId, _fixture.LocationId, namespaceId); var exception = Assert.Throws <RpcException>(() => registrationServiceClient.GetNamespace(namespaceName)); Assert.Equal(StatusCode.NotFound, exception.StatusCode); }
public void CreatesService() { // Setup namespace for the test. var namespaceId = _fixture.RandomResourceId; _fixture.CreateNamespace(namespaceId); var serviceId = _fixture.RandomResourceId; // Run the sample code. var createServiceSample = new CreateServiceSample(); var result = createServiceSample.CreateService(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId); // Get the service. var serviceName = ServiceName.FromProjectLocationNamespaceService(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId); RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create(); var service = registrationServiceClient.GetService(serviceName); Assert.Contains(serviceId, service.Name); }
public void CreatesEndpoint() { // Setup namespace and service for test var namespaceId = _fixture.RandomResourceId; var serviceId = _fixture.RandomResourceId; _fixture.CreateNamespace(namespaceId); _fixture.CreateService(namespaceId, serviceId); var endpointId = _fixture.RandomResourceId; var createEndpointSample = new CreateEndpointSample(); var result = createEndpointSample.CreateEndpoint(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId, endpointId); var endpointName = EndpointName.FromProjectLocationNamespaceServiceEndpoint(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId, endpointId); RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create(); var endpoint = registrationServiceClient.GetEndpoint(endpointName); Assert.Equal(endpoint.Name, result.Name); }