public void MutateCustomerExtensionSettings() { moq::Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient> mockGrpcClient = new moq::Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient>(moq::MockBehavior.Strict); MutateCustomerExtensionSettingsRequest request = new MutateCustomerExtensionSettingsRequest { CustomerId = "customer_id3b3724cb", Operations = { new CustomerExtensionSettingOperation(), }, }; MutateCustomerExtensionSettingsResponse expectedResponse = new MutateCustomerExtensionSettingsResponse { Results = { new MutateCustomerExtensionSettingResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateCustomerExtensionSettings(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CustomerExtensionSettingServiceClient client = new CustomerExtensionSettingServiceClientImpl(mockGrpcClient.Object, null); MutateCustomerExtensionSettingsResponse response = client.MutateCustomerExtensionSettings(request.CustomerId, request.Operations); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateCustomerExtensionSettingsRequestObject() { moq::Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient> mockGrpcClient = new moq::Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient>(moq::MockBehavior.Strict); MutateCustomerExtensionSettingsRequest request = new MutateCustomerExtensionSettingsRequest { CustomerId = "customer_id3b3724cb", Operations = { new CustomerExtensionSettingOperation(), }, PartialFailure = false, ValidateOnly = true, ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly, }; MutateCustomerExtensionSettingsResponse expectedResponse = new MutateCustomerExtensionSettingsResponse { Results = { new MutateCustomerExtensionSettingResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateCustomerExtensionSettings(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CustomerExtensionSettingServiceClient client = new CustomerExtensionSettingServiceClientImpl(mockGrpcClient.Object, null); MutateCustomerExtensionSettingsResponse response = client.MutateCustomerExtensionSettings(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateCustomerExtensionSettings3() { Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient> mockGrpcClient = new Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient>(MockBehavior.Strict); MutateCustomerExtensionSettingsRequest request = new MutateCustomerExtensionSettingsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateCustomerExtensionSettingsResponse expectedResponse = new MutateCustomerExtensionSettingsResponse(); mockGrpcClient.Setup(x => x.MutateCustomerExtensionSettings(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); CustomerExtensionSettingServiceClient client = new CustomerExtensionSettingServiceClientImpl(mockGrpcClient.Object, null); MutateCustomerExtensionSettingsResponse response = client.MutateCustomerExtensionSettings(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateCustomerExtensionSettings() { Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient> mockGrpcClient = new Mock <CustomerExtensionSettingService.CustomerExtensionSettingServiceClient>(MockBehavior.Strict); MutateCustomerExtensionSettingsRequest expectedRequest = new MutateCustomerExtensionSettingsRequest { CustomerId = "customerId-1772061412", Operations = { }, PartialFailure = true, ValidateOnly = false, }; MutateCustomerExtensionSettingsResponse expectedResponse = new MutateCustomerExtensionSettingsResponse(); mockGrpcClient.Setup(x => x.MutateCustomerExtensionSettings(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); CustomerExtensionSettingServiceClient client = new CustomerExtensionSettingServiceClientImpl(mockGrpcClient.Object, null); string customerId = "customerId-1772061412"; IEnumerable <CustomerExtensionSettingOperation> operations = new List <CustomerExtensionSettingOperation>(); bool partialFailure = true; bool validateOnly = false; MutateCustomerExtensionSettingsResponse response = client.MutateCustomerExtensionSettings(customerId, operations, partialFailure, validateOnly); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }