public async stt::Task GetAnnotationSpecResourceNamesAsync() { moq::Mock <DatasetService.DatasetServiceClient> mockGrpcClient = new moq::Mock <DatasetService.DatasetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetAnnotationSpecRequest request = new GetAnnotationSpecRequest { AnnotationSpecName = AnnotationSpecName.FromProjectLocationDatasetAnnotationSpec("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]"), }; AnnotationSpec expectedResponse = new AnnotationSpec { AnnotationSpecName = AnnotationSpecName.FromProjectLocationDatasetAnnotationSpec("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]"), DisplayName = "display_name137f65c2", CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), Etag = "etage8ad7218", }; mockGrpcClient.Setup(x => x.GetAnnotationSpecAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <AnnotationSpec>(stt::Task.FromResult(expectedResponse), null, null, null, null)); DatasetServiceClient client = new DatasetServiceClientImpl(mockGrpcClient.Object, null); AnnotationSpec responseCallSettings = await client.GetAnnotationSpecAsync(request.AnnotationSpecName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); AnnotationSpec responseCancellationToken = await client.GetAnnotationSpecAsync(request.AnnotationSpecName, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async Task GetAnnotationSpecAsync2() { Mock <AutoMl.AutoMlClient> mockGrpcClient = new Mock <AutoMl.AutoMlClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); GetAnnotationSpecRequest request = new GetAnnotationSpecRequest { AnnotationSpecName = new AnnotationSpecName("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]"), }; AnnotationSpec expectedResponse = new AnnotationSpec { Name = "name2-1052831874", DisplayName = "displayName1615086568", ExampleCount = 1517063674, }; mockGrpcClient.Setup(x => x.GetAnnotationSpecAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <AnnotationSpec>(Task.FromResult(expectedResponse), null, null, null, null)); AutoMlClient client = new AutoMlClientImpl(mockGrpcClient.Object, null); AnnotationSpec response = await client.GetAnnotationSpecAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetAnnotationSpecResourceNames() { moq::Mock <DatasetService.DatasetServiceClient> mockGrpcClient = new moq::Mock <DatasetService.DatasetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetAnnotationSpecRequest request = new GetAnnotationSpecRequest { AnnotationSpecName = AnnotationSpecName.FromProjectLocationDatasetAnnotationSpec("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]"), }; AnnotationSpec expectedResponse = new AnnotationSpec { AnnotationSpecName = AnnotationSpecName.FromProjectLocationDatasetAnnotationSpec("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]"), DisplayName = "display_name137f65c2", CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), Etag = "etage8ad7218", }; mockGrpcClient.Setup(x => x.GetAnnotationSpec(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); DatasetServiceClient client = new DatasetServiceClientImpl(mockGrpcClient.Object, null); AnnotationSpec response = client.GetAnnotationSpec(request.AnnotationSpecName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetAnnotationSpecRequestObjectAsync() { moq::Mock <AutoMl.AutoMlClient> mockGrpcClient = new moq::Mock <AutoMl.AutoMlClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetAnnotationSpecRequest request = new GetAnnotationSpecRequest { Name = "name1c9368b0", }; AnnotationSpec expectedResponse = new AnnotationSpec { Name = "name1c9368b0", DisplayName = "display_name137f65c2", ExampleCount = -1179891861, }; mockGrpcClient.Setup(x => x.GetAnnotationSpecAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <AnnotationSpec>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AutoMlClient client = new AutoMlClientImpl(mockGrpcClient.Object, null); AnnotationSpec responseCallSettings = await client.GetAnnotationSpecAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); AnnotationSpec responseCancellationToken = await client.GetAnnotationSpecAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetAnnotationSpec</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetAnnotationSpecResourceNames() { // Create client AutoMlClient autoMlClient = AutoMlClient.Create(); // Initialize request argument(s) AnnotationSpecName name = AnnotationSpecName.FromProjectLocationDatasetAnnotationSpec("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]"); // Make the request AnnotationSpec response = autoMlClient.GetAnnotationSpec(name); }
/// <summary>Snippet for GetAnnotationSpec</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetAnnotationSpec() { // Create client AutoMlClient autoMlClient = AutoMlClient.Create(); // Initialize request argument(s) string name = "projects/[PROJECT]/locations/[LOCATION]/datasets/[DATASET]/annotationSpecs/[ANNOTATION_SPEC]"; // Make the request AnnotationSpec response = autoMlClient.GetAnnotationSpec(name); }
/// <summary>Snippet for GetAnnotationSpec</summary> public void GetAnnotationSpecRequestObject() { // Snippet: GetAnnotationSpec(GetAnnotationSpecRequest, CallSettings) // Create client AutoMlClient autoMlClient = AutoMlClient.Create(); // Initialize request argument(s) GetAnnotationSpecRequest request = new GetAnnotationSpecRequest { Name = "", }; // Make the request AnnotationSpec response = autoMlClient.GetAnnotationSpec(request); // End snippet }
/// <summary>Snippet for GetAnnotationSpecAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetAnnotationSpecRequestObjectAsync() { // Create client AutoMlClient autoMlClient = await AutoMlClient.CreateAsync(); // Initialize request argument(s) GetAnnotationSpecRequest request = new GetAnnotationSpecRequest { AnnotationSpecName = AnnotationSpecName.FromProjectLocationDatasetAnnotationSpec("[PROJECT]", "[LOCATION]", "[DATASET]", "[ANNOTATION_SPEC]"), }; // Make the request AnnotationSpec response = await autoMlClient.GetAnnotationSpecAsync(request); }
/// <summary>Snippet for GetAnnotationSpecAsync</summary> public async Task GetAnnotationSpecRequestObjectAsync() { // Snippet: GetAnnotationSpecAsync(GetAnnotationSpecRequest, CallSettings) // Additional: GetAnnotationSpecAsync(GetAnnotationSpecRequest, CancellationToken) // Create client AutoMlClient autoMlClient = await AutoMlClient.CreateAsync(); // Initialize request argument(s) GetAnnotationSpecRequest request = new GetAnnotationSpecRequest { Name = "", }; // Make the request AnnotationSpec response = await autoMlClient.GetAnnotationSpecAsync(request); // End snippet }
public void GetAnnotationSpecRequestObject() { moq::Mock <AutoMl.AutoMlClient> mockGrpcClient = new moq::Mock <AutoMl.AutoMlClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetAnnotationSpecRequest request = new GetAnnotationSpecRequest { Name = "name1c9368b0", }; AnnotationSpec expectedResponse = new AnnotationSpec { Name = "name1c9368b0", DisplayName = "display_name137f65c2", ExampleCount = -1179891861, }; mockGrpcClient.Setup(x => x.GetAnnotationSpec(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AutoMlClient client = new AutoMlClientImpl(mockGrpcClient.Object, null); AnnotationSpec response = client.GetAnnotationSpec(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }