public async stt::Task MutateLabelsAsync() { moq::Mock <LabelService.LabelServiceClient> mockGrpcClient = new moq::Mock <LabelService.LabelServiceClient>(moq::MockBehavior.Strict); MutateLabelsRequest request = new MutateLabelsRequest { CustomerId = "customer_id3b3724cb", Operations = { new LabelOperation(), }, }; MutateLabelsResponse expectedResponse = new MutateLabelsResponse { Results = { new MutateLabelResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateLabelsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateLabelsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); LabelServiceClient client = new LabelServiceClientImpl(mockGrpcClient.Object, null); MutateLabelsResponse responseCallSettings = await client.MutateLabelsAsync(request.CustomerId, request.Operations, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); MutateLabelsResponse responseCancellationToken = await client.MutateLabelsAsync(request.CustomerId, request.Operations, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void MutateLabelsRequestObject() { moq::Mock <LabelService.LabelServiceClient> mockGrpcClient = new moq::Mock <LabelService.LabelServiceClient>(moq::MockBehavior.Strict); MutateLabelsRequest request = new MutateLabelsRequest { CustomerId = "customer_id3b3724cb", Operations = { new LabelOperation(), }, PartialFailure = false, ValidateOnly = true, ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly, }; MutateLabelsResponse expectedResponse = new MutateLabelsResponse { Results = { new MutateLabelResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateLabels(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); LabelServiceClient client = new LabelServiceClientImpl(mockGrpcClient.Object, null); MutateLabelsResponse response = client.MutateLabels(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateLabels() { moq::Mock <LabelService.LabelServiceClient> mockGrpcClient = new moq::Mock <LabelService.LabelServiceClient>(moq::MockBehavior.Strict); MutateLabelsRequest request = new MutateLabelsRequest { CustomerId = "customer_id3b3724cb", Operations = { new LabelOperation(), }, }; MutateLabelsResponse expectedResponse = new MutateLabelsResponse { Results = { new MutateLabelResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateLabels(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); LabelServiceClient client = new LabelServiceClientImpl(mockGrpcClient.Object, null); MutateLabelsResponse response = client.MutateLabels(request.CustomerId, request.Operations); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for MutateLabels</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void MutateLabels() { // Create client LabelServiceClient labelServiceClient = LabelServiceClient.Create(); // Initialize request argument(s) string customerId = ""; IEnumerable <LabelOperation> operations = new LabelOperation[] { new LabelOperation(), }; // Make the request MutateLabelsResponse response = labelServiceClient.MutateLabels(customerId, operations); }
/// <summary>Snippet for MutateLabelsAsync</summary> public async Task MutateLabelsAsync() { // Snippet: MutateLabelsAsync(string, IEnumerable<LabelOperation>, CallSettings) // Additional: MutateLabelsAsync(string, IEnumerable<LabelOperation>, CancellationToken) // Create client LabelServiceClient labelServiceClient = await LabelServiceClient.CreateAsync(); // Initialize request argument(s) string customerId = ""; IEnumerable <LabelOperation> operations = new LabelOperation[] { new LabelOperation(), }; // Make the request MutateLabelsResponse response = await labelServiceClient.MutateLabelsAsync(customerId, operations); // End snippet }
public async Task MutateLabelsAsync3() { Mock <LabelService.LabelServiceClient> mockGrpcClient = new Mock <LabelService.LabelServiceClient>(MockBehavior.Strict); MutateLabelsRequest request = new MutateLabelsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateLabelsResponse expectedResponse = new MutateLabelsResponse(); mockGrpcClient.Setup(x => x.MutateLabelsAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MutateLabelsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); LabelServiceClient client = new LabelServiceClientImpl(mockGrpcClient.Object, null); MutateLabelsResponse response = await client.MutateLabelsAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateLabels3() { Mock <LabelService.LabelServiceClient> mockGrpcClient = new Mock <LabelService.LabelServiceClient>(MockBehavior.Strict); MutateLabelsRequest request = new MutateLabelsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateLabelsResponse expectedResponse = new MutateLabelsResponse(); mockGrpcClient.Setup(x => x.MutateLabels(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); LabelServiceClient client = new LabelServiceClientImpl(mockGrpcClient.Object, null); MutateLabelsResponse response = client.MutateLabels(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for MutateLabels</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void MutateLabelsRequestObject() { // Create client LabelServiceClient labelServiceClient = LabelServiceClient.Create(); // Initialize request argument(s) MutateLabelsRequest request = new MutateLabelsRequest { CustomerId = "", Operations = { new LabelOperation(), }, PartialFailure = false, ValidateOnly = false, }; // Make the request MutateLabelsResponse response = labelServiceClient.MutateLabels(request); }
/// <summary>Snippet for MutateLabelsAsync</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 MutateLabelsRequestObjectAsync() { // Create client LabelServiceClient labelServiceClient = await LabelServiceClient.CreateAsync(); // Initialize request argument(s) MutateLabelsRequest request = new MutateLabelsRequest { CustomerId = "", Operations = { new LabelOperation(), }, PartialFailure = false, ValidateOnly = false, ResponseContentType = ResponseContentTypeEnum.Types.ResponseContentType.Unspecified, }; // Make the request MutateLabelsResponse response = await labelServiceClient.MutateLabelsAsync(request); }
/// <summary>Snippet for MutateLabels</summary> public void MutateLabelsRequestObject() { // Snippet: MutateLabels(MutateLabelsRequest, CallSettings) // Create client LabelServiceClient labelServiceClient = LabelServiceClient.Create(); // Initialize request argument(s) MutateLabelsRequest request = new MutateLabelsRequest { CustomerId = "", Operations = { new LabelOperation(), }, PartialFailure = false, ValidateOnly = false, ResponseContentType = ResponseContentTypeEnum.Types.ResponseContentType.Unspecified, }; // Make the request MutateLabelsResponse response = labelServiceClient.MutateLabels(request); // End snippet }
/// <summary>Snippet for MutateLabelsAsync</summary> public async Task MutateLabelsRequestObjectAsync() { // Snippet: MutateLabelsAsync(MutateLabelsRequest, CallSettings) // Additional: MutateLabelsAsync(MutateLabelsRequest, CancellationToken) // Create client LabelServiceClient labelServiceClient = await LabelServiceClient.CreateAsync(); // Initialize request argument(s) MutateLabelsRequest request = new MutateLabelsRequest { CustomerId = "", Operations = { new LabelOperation(), }, PartialFailure = false, ValidateOnly = false, }; // Make the request MutateLabelsResponse response = await labelServiceClient.MutateLabelsAsync(request); // End snippet }
public async Task MutateLabelsAsync() { Mock <LabelService.LabelServiceClient> mockGrpcClient = new Mock <LabelService.LabelServiceClient>(MockBehavior.Strict); MutateLabelsRequest expectedRequest = new MutateLabelsRequest { CustomerId = "customerId-1772061412", Operations = { }, PartialFailure = true, ValidateOnly = false, }; MutateLabelsResponse expectedResponse = new MutateLabelsResponse(); mockGrpcClient.Setup(x => x.MutateLabelsAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MutateLabelsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); LabelServiceClient client = new LabelServiceClientImpl(mockGrpcClient.Object, null); string customerId = "customerId-1772061412"; IEnumerable <LabelOperation> operations = new List <LabelOperation>(); bool partialFailure = true; bool validateOnly = false; MutateLabelsResponse response = await client.MutateLabelsAsync(customerId, operations, partialFailure, validateOnly); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }