コード例 #1
0
 /// <summary>Snippet for GetUptimeCheckConfig</summary>
 public void GetUptimeCheckConfig_RequestObject()
 {
     // Snippet: GetUptimeCheckConfig(GetUptimeCheckConfigRequest,CallSettings)
     // Create client
     UptimeCheckServiceClient uptimeCheckServiceClient = UptimeCheckServiceClient.Create();
     // Initialize request argument(s)
     GetUptimeCheckConfigRequest request = new GetUptimeCheckConfigRequest
     {
         Name = new UptimeCheckConfigName("[PROJECT]", "[UPTIME_CHECK_CONFIG]").ToString(),
     };
     // Make the request
     UptimeCheckConfig response = uptimeCheckServiceClient.GetUptimeCheckConfig(request);
     // End snippet
 }
コード例 #2
0
        /// <summary>Snippet for GetUptimeCheckConfigAsync</summary>
        public async Task GetUptimeCheckConfigAsync_RequestObject()
        {
            // Snippet: GetUptimeCheckConfigAsync(GetUptimeCheckConfigRequest,CallSettings)
            // Additional: GetUptimeCheckConfigAsync(GetUptimeCheckConfigRequest,CancellationToken)
            // Create client
            UptimeCheckServiceClient uptimeCheckServiceClient = await UptimeCheckServiceClient.CreateAsync();

            // Initialize request argument(s)
            GetUptimeCheckConfigRequest request = new GetUptimeCheckConfigRequest
            {
                Name = new UptimeCheckConfigName("[PROJECT]", "[UPTIME_CHECK_CONFIG]").ToString(),
            };
            // Make the request
            UptimeCheckConfig response = await uptimeCheckServiceClient.GetUptimeCheckConfigAsync(request);

            // End snippet
        }
コード例 #3
0
        public void GetUptimeCheckConfig2()
        {
            Mock <UptimeCheckService.UptimeCheckServiceClient> mockGrpcClient = new Mock <UptimeCheckService.UptimeCheckServiceClient>(MockBehavior.Strict);
            GetUptimeCheckConfigRequest request = new GetUptimeCheckConfigRequest
            {
                Name = new UptimeCheckConfigName("[PROJECT]", "[UPTIME_CHECK_CONFIG]").ToString(),
            };
            UptimeCheckConfig expectedResponse = new UptimeCheckConfig
            {
                Name        = "name2-1052831874",
                DisplayName = "displayName1615086568",
            };

            mockGrpcClient.Setup(x => x.GetUptimeCheckConfig(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            UptimeCheckServiceClient client   = new UptimeCheckServiceClientImpl(mockGrpcClient.Object, null);
            UptimeCheckConfig        response = client.GetUptimeCheckConfig(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #4
0
        public async Task GetUptimeCheckConfigAsync2()
        {
            Mock <UptimeCheckService.UptimeCheckServiceClient> mockGrpcClient = new Mock <UptimeCheckService.UptimeCheckServiceClient>(MockBehavior.Strict);
            GetUptimeCheckConfigRequest request = new GetUptimeCheckConfigRequest
            {
                UptimeCheckConfigName = new UptimeCheckConfigName("[PROJECT]", "[UPTIME_CHECK_CONFIG]"),
            };
            UptimeCheckConfig expectedResponse = new UptimeCheckConfig
            {
                Name        = "name2-1052831874",
                DisplayName = "displayName1615086568",
                IsInternal  = true,
            };

            mockGrpcClient.Setup(x => x.GetUptimeCheckConfigAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <UptimeCheckConfig>(Task.FromResult(expectedResponse), null, null, null, null));
            UptimeCheckServiceClient client   = new UptimeCheckServiceClientImpl(mockGrpcClient.Object, null);
            UptimeCheckConfig        response = await client.GetUptimeCheckConfigAsync(request);

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