Пример #1
0
 /// <summary>Snippet for GetServiceLevelObjective</summary>
 public void GetServiceLevelObjective()
 {
     // Snippet: GetServiceLevelObjective(ServiceLevelObjectiveName,CallSettings)
     // Create client
     ServiceMonitoringServiceClient serviceMonitoringServiceClient = ServiceMonitoringServiceClient.Create();
     // Initialize request argument(s)
     ServiceLevelObjectiveName name = new ServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]");
     // Make the request
     ServiceLevelObjective response = serviceMonitoringServiceClient.GetServiceLevelObjective(name);
     // End snippet
 }
Пример #2
0
        /// <summary>Snippet for DeleteServiceLevelObjectiveAsync</summary>
        public async Task DeleteServiceLevelObjectiveAsync()
        {
            // Snippet: DeleteServiceLevelObjectiveAsync(ServiceLevelObjectiveName,CallSettings)
            // Additional: DeleteServiceLevelObjectiveAsync(ServiceLevelObjectiveName,CancellationToken)
            // Create client
            ServiceMonitoringServiceClient serviceMonitoringServiceClient = await ServiceMonitoringServiceClient.CreateAsync();

            // Initialize request argument(s)
            ServiceLevelObjectiveName name = new ServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]");
            // Make the request
            await serviceMonitoringServiceClient.DeleteServiceLevelObjectiveAsync(name);

            // End snippet
        }
Пример #3
0
        public async Task DeleteServiceLevelObjectiveAsync()
        {
            Mock <ServiceMonitoringService.ServiceMonitoringServiceClient> mockGrpcClient = new Mock <ServiceMonitoringService.ServiceMonitoringServiceClient>(MockBehavior.Strict);
            DeleteServiceLevelObjectiveRequest expectedRequest = new DeleteServiceLevelObjectiveRequest
            {
                ServiceLevelObjectiveName = new ServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]"),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteServiceLevelObjectiveAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null));
            ServiceMonitoringServiceClient client = new ServiceMonitoringServiceClientImpl(mockGrpcClient.Object, null);
            ServiceLevelObjectiveName      name   = new ServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]");
            await client.DeleteServiceLevelObjectiveAsync(name);

            mockGrpcClient.VerifyAll();
        }
Пример #4
0
        public void DeleteServiceLevelObjective()
        {
            Mock <ServiceMonitoringService.ServiceMonitoringServiceClient> mockGrpcClient = new Mock <ServiceMonitoringService.ServiceMonitoringServiceClient>(MockBehavior.Strict);
            DeleteServiceLevelObjectiveRequest expectedRequest = new DeleteServiceLevelObjectiveRequest
            {
                ServiceLevelObjectiveName = new ServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]"),
            };
            Empty expectedResponse = new Empty();

            mockGrpcClient.Setup(x => x.DeleteServiceLevelObjective(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ServiceMonitoringServiceClient client = new ServiceMonitoringServiceClientImpl(mockGrpcClient.Object, null);
            ServiceLevelObjectiveName      name   = new ServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]");

            client.DeleteServiceLevelObjective(name);
            mockGrpcClient.VerifyAll();
        }
Пример #5
0
        public async Task GetServiceLevelObjectiveAsync()
        {
            Mock <ServiceMonitoringService.ServiceMonitoringServiceClient> mockGrpcClient = new Mock <ServiceMonitoringService.ServiceMonitoringServiceClient>(MockBehavior.Strict);
            GetServiceLevelObjectiveRequest expectedRequest = new GetServiceLevelObjectiveRequest
            {
                ServiceLevelObjectiveName = new ServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]"),
            };
            ServiceLevelObjective expectedResponse = new ServiceLevelObjective
            {
                ServiceLevelObjectiveName = new ServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]"),
                DisplayName = "displayName1615086568",
                Goal        = 317825.0,
            };

            mockGrpcClient.Setup(x => x.GetServiceLevelObjectiveAsync(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <ServiceLevelObjective>(Task.FromResult(expectedResponse), null, null, null, null));
            ServiceMonitoringServiceClient client   = new ServiceMonitoringServiceClientImpl(mockGrpcClient.Object, null);
            ServiceLevelObjectiveName      name     = new ServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]");
            ServiceLevelObjective          response = await client.GetServiceLevelObjectiveAsync(name);

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