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 DeletesService() { // Setup namespace and service for the test. var namespaceId = _fixture.RandomResourceId; var serviceId = _fixture.RandomResourceId; _fixture.CreateNamespace(namespaceId); _fixture.CreateService(namespaceId, serviceId); // Run the sample code. var deleteServiceSample = new DeleteServiceSample(); deleteServiceSample.DeleteService(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId); // Try to get the service. RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create(); var serviceName = ServiceName.FromProjectLocationNamespaceService(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId); var exception = Assert.Throws <RpcException>(() => registrationServiceClient.GetService(serviceName)); Assert.Equal(StatusCode.NotFound, exception.StatusCode); }