public async stt::Task GetStatusAsync()
        {
            moq::Mock <VpnGateways.VpnGatewaysClient> mockGrpcClient = new moq::Mock <VpnGateways.VpnGatewaysClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForRegionOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetStatusVpnGatewayRequest request = new GetStatusVpnGatewayRequest
            {
                Region     = "regionedb20d96",
                Project    = "projectaa6ff846",
                VpnGateway = "vpn_gatewayaa15de14",
            };
            VpnGatewaysGetStatusResponse expectedResponse = new VpnGatewaysGetStatusResponse
            {
                Result = new VpnGatewayStatus(),
            };

            mockGrpcClient.Setup(x => x.GetStatusAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <VpnGatewaysGetStatusResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            VpnGatewaysClient            client = new VpnGatewaysClientImpl(mockGrpcClient.Object, null);
            VpnGatewaysGetStatusResponse responseCallSettings = await client.GetStatusAsync(request.Project, request.Region, request.VpnGateway, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            VpnGatewaysGetStatusResponse responseCancellationToken = await client.GetStatusAsync(request.Project, request.Region, request.VpnGateway, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Пример #2
0
 /// <summary>Snippet for GetStatus</summary>
 public void GetStatus()
 {
     // Snippet: GetStatus(string, string, string, CallSettings)
     // Create client
     VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.Create();
     // Initialize request argument(s)
     string project    = "";
     string region     = "";
     string vpnGateway = "";
     // Make the request
     VpnGatewaysGetStatusResponse response = vpnGatewaysClient.GetStatus(project, region, vpnGateway);
     // End snippet
 }
Пример #3
0
        /// <summary>Snippet for GetStatusAsync</summary>
        public async Task GetStatusAsync()
        {
            // Snippet: GetStatusAsync(string, string, string, CallSettings)
            // Additional: GetStatusAsync(string, string, string, CancellationToken)
            // Create client
            VpnGatewaysClient vpnGatewaysClient = await VpnGatewaysClient.CreateAsync();

            // Initialize request argument(s)
            string project    = "";
            string region     = "";
            string vpnGateway = "";
            // Make the request
            VpnGatewaysGetStatusResponse response = await vpnGatewaysClient.GetStatusAsync(project, region, vpnGateway);

            // End snippet
        }
Пример #4
0
 /// <summary>Snippet for GetStatus</summary>
 public void GetStatusRequestObject()
 {
     // Snippet: GetStatus(GetStatusVpnGatewayRequest, CallSettings)
     // Create client
     VpnGatewaysClient vpnGatewaysClient = VpnGatewaysClient.Create();
     // Initialize request argument(s)
     GetStatusVpnGatewayRequest request = new GetStatusVpnGatewayRequest
     {
         Region     = "",
         Project    = "",
         VpnGateway = "",
     };
     // Make the request
     VpnGatewaysGetStatusResponse response = vpnGatewaysClient.GetStatus(request);
     // End snippet
 }
Пример #5
0
        /// <summary>Snippet for GetStatusAsync</summary>
        public async Task GetStatusRequestObjectAsync()
        {
            // Snippet: GetStatusAsync(GetStatusVpnGatewayRequest, CallSettings)
            // Additional: GetStatusAsync(GetStatusVpnGatewayRequest, CancellationToken)
            // Create client
            VpnGatewaysClient vpnGatewaysClient = await VpnGatewaysClient.CreateAsync();

            // Initialize request argument(s)
            GetStatusVpnGatewayRequest request = new GetStatusVpnGatewayRequest
            {
                Region     = "",
                Project    = "",
                VpnGateway = "",
            };
            // Make the request
            VpnGatewaysGetStatusResponse response = await vpnGatewaysClient.GetStatusAsync(request);

            // End snippet
        }
        public void GetStatus()
        {
            moq::Mock <VpnGateways.VpnGatewaysClient> mockGrpcClient = new moq::Mock <VpnGateways.VpnGatewaysClient>(moq::MockBehavior.Strict);

            mockGrpcClient.Setup(x => x.CreateOperationsClientForRegionOperations()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object);
            GetStatusVpnGatewayRequest request = new GetStatusVpnGatewayRequest
            {
                Region     = "regionedb20d96",
                Project    = "projectaa6ff846",
                VpnGateway = "vpn_gatewayaa15de14",
            };
            VpnGatewaysGetStatusResponse expectedResponse = new VpnGatewaysGetStatusResponse
            {
                Result = new VpnGatewayStatus(),
            };

            mockGrpcClient.Setup(x => x.GetStatus(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            VpnGatewaysClient            client   = new VpnGatewaysClientImpl(mockGrpcClient.Object, null);
            VpnGatewaysGetStatusResponse response = client.GetStatus(request.Project, request.Region, request.VpnGateway);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }