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); }
public void DeletesEndpoint() { // Setup namespace, service, and endpoint 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 deleteEndpointSample = new DeleteEndpointSample(); deleteEndpointSample.DeleteEndpoint(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId, endpointId); // Try to get the endpoint. RegistrationServiceClient registrationServiceClient = RegistrationServiceClient.Create(); var endpointName = EndpointName.FromProjectLocationNamespaceServiceEndpoint(_fixture.ProjectId, _fixture.LocationId, namespaceId, serviceId, endpointId); var exception = Assert.Throws <RpcException>(() => registrationServiceClient.GetEndpoint(endpointName)); Assert.Equal(StatusCode.NotFound, exception.StatusCode); }