/// <summary>Snippet for UpdateServiceLevelObjective</summary> public void UpdateServiceLevelObjective_RequestObject() { // Snippet: UpdateServiceLevelObjective(UpdateServiceLevelObjectiveRequest,CallSettings) // Create client ServiceMonitoringServiceClient serviceMonitoringServiceClient = ServiceMonitoringServiceClient.Create(); // Initialize request argument(s) UpdateServiceLevelObjectiveRequest request = new UpdateServiceLevelObjectiveRequest { ServiceLevelObjective = new ServiceLevelObjective(), }; // Make the request ServiceLevelObjective response = serviceMonitoringServiceClient.UpdateServiceLevelObjective(request); // End snippet }
/// <summary>Snippet for UpdateServiceLevelObjectiveAsync</summary> public async Task UpdateServiceLevelObjectiveAsync_RequestObject() { // Snippet: UpdateServiceLevelObjectiveAsync(UpdateServiceLevelObjectiveRequest,CallSettings) // Additional: UpdateServiceLevelObjectiveAsync(UpdateServiceLevelObjectiveRequest,CancellationToken) // Create client ServiceMonitoringServiceClient serviceMonitoringServiceClient = await ServiceMonitoringServiceClient.CreateAsync(); // Initialize request argument(s) UpdateServiceLevelObjectiveRequest request = new UpdateServiceLevelObjectiveRequest { ServiceLevelObjective = new ServiceLevelObjective(), }; // Make the request ServiceLevelObjective response = await serviceMonitoringServiceClient.UpdateServiceLevelObjectiveAsync(request); // End snippet }
public async Task UpdateServiceLevelObjectiveAsync2() { Mock <ServiceMonitoringService.ServiceMonitoringServiceClient> mockGrpcClient = new Mock <ServiceMonitoringService.ServiceMonitoringServiceClient>(MockBehavior.Strict); UpdateServiceLevelObjectiveRequest request = new UpdateServiceLevelObjectiveRequest { ServiceLevelObjective = new ServiceLevelObjective(), }; ServiceLevelObjective expectedResponse = new ServiceLevelObjective { ServiceLevelObjectiveName = new ServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]"), DisplayName = "displayName1615086568", Goal = 317825.0, }; mockGrpcClient.Setup(x => x.UpdateServiceLevelObjectiveAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <ServiceLevelObjective>(Task.FromResult(expectedResponse), null, null, null, null)); ServiceMonitoringServiceClient client = new ServiceMonitoringServiceClientImpl(mockGrpcClient.Object, null); ServiceLevelObjective response = await client.UpdateServiceLevelObjectiveAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void UpdateServiceLevelObjective() { Mock <ServiceMonitoringService.ServiceMonitoringServiceClient> mockGrpcClient = new Mock <ServiceMonitoringService.ServiceMonitoringServiceClient>(MockBehavior.Strict); UpdateServiceLevelObjectiveRequest expectedRequest = new UpdateServiceLevelObjectiveRequest { ServiceLevelObjective = new ServiceLevelObjective(), }; ServiceLevelObjective expectedResponse = new ServiceLevelObjective { ServiceLevelObjectiveName = new ServiceLevelObjectiveName("[PROJECT]", "[SERVICE]", "[SERVICE_LEVEL_OBJECTIVE]"), DisplayName = "displayName1615086568", Goal = 317825.0, }; mockGrpcClient.Setup(x => x.UpdateServiceLevelObjective(expectedRequest, It.IsAny <CallOptions>())) .Returns(expectedResponse); ServiceMonitoringServiceClient client = new ServiceMonitoringServiceClientImpl(mockGrpcClient.Object, null); ServiceLevelObjective serviceLevelObjective = new ServiceLevelObjective(); ServiceLevelObjective response = client.UpdateServiceLevelObjective(serviceLevelObjective); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }