public async Task CreateCustomerClientAsync() { Mock <CustomerService.CustomerServiceClient> mockGrpcClient = new Mock <CustomerService.CustomerServiceClient>(MockBehavior.Strict); CreateCustomerClientRequest expectedRequest = new CreateCustomerClientRequest { CustomerId = "customerId-1772061412", CustomerClient = new Customer(), EmailAddress = null, AccessRole = AccessRoleEnum.Types.AccessRole.Unspecified, }; CreateCustomerClientResponse expectedResponse = new CreateCustomerClientResponse { ResourceName = "resourceName979421212", }; mockGrpcClient.Setup(x => x.CreateCustomerClientAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <CreateCustomerClientResponse>(Task.FromResult(expectedResponse), null, null, null, null)); CustomerServiceClient client = new CustomerServiceClientImpl(mockGrpcClient.Object, null); string customerId = "customerId-1772061412"; Customer customerClient = new Customer(); string emailAddress = null; AccessRoleEnum.Types.AccessRole accessRole = AccessRoleEnum.Types.AccessRole.Unspecified; CreateCustomerClientResponse response = await client.CreateCustomerClientAsync(customerId, customerClient, emailAddress, accessRole); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task CreateCustomerClientRequestObjectAsync() { moq::Mock <CustomerService.CustomerServiceClient> mockGrpcClient = new moq::Mock <CustomerService.CustomerServiceClient>(moq::MockBehavior.Strict); CreateCustomerClientRequest request = new CreateCustomerClientRequest { CustomerId = "customer_id3b3724cb", CustomerClient = new gagvr::Customer(), AccessRole = gagve::AccessRoleEnum.Types.AccessRole.Unspecified, EmailAddress = "email_addressf3aae0b5", ValidateOnly = true, }; CreateCustomerClientResponse expectedResponse = new CreateCustomerClientResponse { ResourceName = "resource_name8cc2e687", InvitationLink = "invitation_linkd5742ce9", }; mockGrpcClient.Setup(x => x.CreateCustomerClientAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <CreateCustomerClientResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); CustomerServiceClient client = new CustomerServiceClientImpl(mockGrpcClient.Object, null); CreateCustomerClientResponse responseCallSettings = await client.CreateCustomerClientAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); CreateCustomerClientResponse responseCancellationToken = await client.CreateCustomerClientAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for CreateCustomerClient</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void CreateCustomerClientRequestObject() { // Create client CustomerServiceClient customerServiceClient = CustomerServiceClient.Create(); // Initialize request argument(s) CreateCustomerClientRequest request = new CreateCustomerClientRequest { CustomerId = "", CustomerClient = new Customer(), AccessRole = AccessRoleEnum.Types.AccessRole.Unspecified, EmailAddress = "", }; // Make the request CreateCustomerClientResponse response = customerServiceClient.CreateCustomerClient(request); }
/// <summary>Snippet for CreateCustomerClientAsync</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 CreateCustomerClientRequestObjectAsync() { // Create client CustomerServiceClient customerServiceClient = await CustomerServiceClient.CreateAsync(); // Initialize request argument(s) CreateCustomerClientRequest request = new CreateCustomerClientRequest { CustomerId = "", CustomerClient = new Customer(), EmailAddress = "", AccessRole = AccessRoleEnum.Types.AccessRole.Unspecified, }; // Make the request CreateCustomerClientResponse response = await customerServiceClient.CreateCustomerClientAsync(request); }
/// <summary>Snippet for CreateCustomerClient</summary> public void CreateCustomerClientRequestObject() { // Snippet: CreateCustomerClient(CreateCustomerClientRequest, CallSettings) // Create client CustomerServiceClient customerServiceClient = CustomerServiceClient.Create(); // Initialize request argument(s) CreateCustomerClientRequest request = new CreateCustomerClientRequest { CustomerId = "", CustomerClient = new Customer(), AccessRole = AccessRoleEnum.Types.AccessRole.Unspecified, EmailAddress = "", ValidateOnly = false, }; // Make the request CreateCustomerClientResponse response = customerServiceClient.CreateCustomerClient(request); // End snippet }
public void CreateCustomerClient() { moq::Mock <CustomerService.CustomerServiceClient> mockGrpcClient = new moq::Mock <CustomerService.CustomerServiceClient>(moq::MockBehavior.Strict); CreateCustomerClientRequest request = new CreateCustomerClientRequest { CustomerId = "customer_id3b3724cb", CustomerClient = new gagvr::Customer(), }; CreateCustomerClientResponse expectedResponse = new CreateCustomerClientResponse { ResourceName = "resource_name8cc2e687", }; mockGrpcClient.Setup(x => x.CreateCustomerClient(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CustomerServiceClient client = new CustomerServiceClientImpl(mockGrpcClient.Object, null); CreateCustomerClientResponse response = client.CreateCustomerClient(request.CustomerId, request.CustomerClient); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for CreateCustomerClientAsync</summary> public async Task CreateCustomerClientRequestObjectAsync() { // Snippet: CreateCustomerClientAsync(CreateCustomerClientRequest, CallSettings) // Additional: CreateCustomerClientAsync(CreateCustomerClientRequest, CancellationToken) // Create client CustomerServiceClient customerServiceClient = await CustomerServiceClient.CreateAsync(); // Initialize request argument(s) CreateCustomerClientRequest request = new CreateCustomerClientRequest { CustomerId = "", CustomerClient = new Customer(), AccessRole = AccessRoleEnum.Types.AccessRole.Unspecified, EmailAddress = "", }; // Make the request CreateCustomerClientResponse response = await customerServiceClient.CreateCustomerClientAsync(request); // End snippet }
public void CreateCustomerClient() { moq::Mock <CustomerService.CustomerServiceClient> mockGrpcClient = new moq::Mock <CustomerService.CustomerServiceClient>(moq::MockBehavior.Strict); CreateCustomerClientRequest request = new CreateCustomerClientRequest { CustomerId = "customer_id3b3724cb", CustomerClient = new gagvr::Customer(), }; CreateCustomerClientResponse expectedResponse = new CreateCustomerClientResponse { ResourceNameAsCustomerName = gagvr::CustomerName.FromCustomer("[CUSTOMER_ID]"), InvitationLink = "invitation_linkd5742ce9", }; mockGrpcClient.Setup(x => x.CreateCustomerClient(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CustomerServiceClient client = new CustomerServiceClientImpl(mockGrpcClient.Object, null); CreateCustomerClientResponse response = client.CreateCustomerClient(request.CustomerId, request.CustomerClient); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task CreateCustomerClientAsync2() { Mock <CustomerService.CustomerServiceClient> mockGrpcClient = new Mock <CustomerService.CustomerServiceClient>(MockBehavior.Strict); CreateCustomerClientRequest request = new CreateCustomerClientRequest { CustomerId = "customerId-1772061412", CustomerClient = new Customer(), }; CreateCustomerClientResponse expectedResponse = new CreateCustomerClientResponse { ResourceName = "resourceName979421212", }; mockGrpcClient.Setup(x => x.CreateCustomerClientAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <CreateCustomerClientResponse>(Task.FromResult(expectedResponse), null, null, null, null)); CustomerServiceClient client = new CustomerServiceClientImpl(mockGrpcClient.Object, null); CreateCustomerClientResponse response = await client.CreateCustomerClientAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void CreateCustomerClient2() { Mock <CustomerService.CustomerServiceClient> mockGrpcClient = new Mock <CustomerService.CustomerServiceClient>(MockBehavior.Strict); CreateCustomerClientRequest request = new CreateCustomerClientRequest { CustomerId = "customerId-1772061412", CustomerClient = new Customer(), }; CreateCustomerClientResponse expectedResponse = new CreateCustomerClientResponse { ResourceName = "resourceName979421212", }; mockGrpcClient.Setup(x => x.CreateCustomerClient(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); CustomerServiceClient client = new CustomerServiceClientImpl(mockGrpcClient.Object, null); CreateCustomerClientResponse response = client.CreateCustomerClient(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void CreateCustomerClientRequestObject() { moq::Mock <CustomerService.CustomerServiceClient> mockGrpcClient = new moq::Mock <CustomerService.CustomerServiceClient>(moq::MockBehavior.Strict); CreateCustomerClientRequest request = new CreateCustomerClientRequest { CustomerId = "customer_id3b3724cb", CustomerClient = new gagvr::Customer(), EmailAddress = "email_addressf3aae0b5", AccessRole = gagve::AccessRoleEnum.Types.AccessRole.Unspecified, }; CreateCustomerClientResponse expectedResponse = new CreateCustomerClientResponse { ResourceName = "resource_name8cc2e687", }; mockGrpcClient.Setup(x => x.CreateCustomerClient(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CustomerServiceClient client = new CustomerServiceClientImpl(mockGrpcClient.Object, null); CreateCustomerClientResponse response = client.CreateCustomerClient(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task CreateCustomerClientAsync() { moq::Mock <CustomerService.CustomerServiceClient> mockGrpcClient = new moq::Mock <CustomerService.CustomerServiceClient>(moq::MockBehavior.Strict); CreateCustomerClientRequest request = new CreateCustomerClientRequest { CustomerId = "customer_id3b3724cb", CustomerClient = new gagvr::Customer(), }; CreateCustomerClientResponse expectedResponse = new CreateCustomerClientResponse { ResourceName = "resource_name8cc2e687", }; mockGrpcClient.Setup(x => x.CreateCustomerClientAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <CreateCustomerClientResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); CustomerServiceClient client = new CustomerServiceClientImpl(mockGrpcClient.Object, null); CreateCustomerClientResponse responseCallSettings = await client.CreateCustomerClientAsync(request.CustomerId, request.CustomerClient, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); CreateCustomerClientResponse responseCancellationToken = await client.CreateCustomerClientAsync(request.CustomerId, request.CustomerClient, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void CreateCustomerClientRequestObject() { moq::Mock <CustomerService.CustomerServiceClient> mockGrpcClient = new moq::Mock <CustomerService.CustomerServiceClient>(moq::MockBehavior.Strict); CreateCustomerClientRequest request = new CreateCustomerClientRequest { CustomerId = "customer_id3b3724cb", CustomerClient = new gagvr::Customer(), AccessRole = gagve::AccessRoleEnum.Types.AccessRole.Unspecified, EmailAddress = "email_addressf3aae0b5", ValidateOnly = true, }; CreateCustomerClientResponse expectedResponse = new CreateCustomerClientResponse { ResourceNameAsCustomerName = gagvr::CustomerName.FromCustomer("[CUSTOMER_ID]"), InvitationLink = "invitation_linkd5742ce9", }; mockGrpcClient.Setup(x => x.CreateCustomerClient(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); CustomerServiceClient client = new CustomerServiceClientImpl(mockGrpcClient.Object, null); CreateCustomerClientResponse response = client.CreateCustomerClient(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary> /// Creates a new client under manager. The new client customer is returned. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override stt::Task <CreateCustomerClientResponse> CreateCustomerClientAsync(CreateCustomerClientRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_CreateCustomerClientRequest(ref request, ref callSettings); return(_callCreateCustomerClient.Async(request, callSettings)); }
partial void Modify_CreateCustomerClientRequest(ref CreateCustomerClientRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Creates a new client under manager. The new client customer is returned. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <CreateCustomerClientResponse> CreateCustomerClientAsync(CreateCustomerClientRequest request, st::CancellationToken cancellationToken) => CreateCustomerClientAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Creates a new client under manager. The new client customer is returned. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <CreateCustomerClientResponse> CreateCustomerClientAsync(CreateCustomerClientRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();