public async Task DeleteAlertPolicyAsync2() { Mock <AlertPolicyService.AlertPolicyServiceClient> mockGrpcClient = new Mock <AlertPolicyService.AlertPolicyServiceClient>(MockBehavior.Strict); DeleteAlertPolicyRequest request = new DeleteAlertPolicyRequest { AlertPolicyName = new AlertPolicyName("[PROJECT]", "[ALERT_POLICY]"), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteAlertPolicyAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null)); AlertPolicyServiceClient client = new AlertPolicyServiceClientImpl(mockGrpcClient.Object, null); await client.DeleteAlertPolicyAsync(request); mockGrpcClient.VerifyAll(); }
public void DeleteAlertPolicy2() { Mock <AlertPolicyService.AlertPolicyServiceClient> mockGrpcClient = new Mock <AlertPolicyService.AlertPolicyServiceClient>(MockBehavior.Strict); DeleteAlertPolicyRequest request = new DeleteAlertPolicyRequest { AlertPolicyName = new AlertPolicyName("[PROJECT]", "[ALERT_POLICY]"), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteAlertPolicy(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); AlertPolicyServiceClient client = new AlertPolicyServiceClientImpl(mockGrpcClient.Object, null); client.DeleteAlertPolicy(request); mockGrpcClient.VerifyAll(); }
public void GetAlertPolicy2() { Mock <AlertPolicyService.AlertPolicyServiceClient> mockGrpcClient = new Mock <AlertPolicyService.AlertPolicyServiceClient>(MockBehavior.Strict); GetAlertPolicyRequest request = new GetAlertPolicyRequest { AlertPolicyName = new AlertPolicyName("[PROJECT]", "[ALERT_POLICY]"), }; AlertPolicy expectedResponse = new AlertPolicy { Name = "name2-1052831874", DisplayName = "displayName1615086568", }; mockGrpcClient.Setup(x => x.GetAlertPolicy(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); AlertPolicyServiceClient client = new AlertPolicyServiceClientImpl(mockGrpcClient.Object, null); AlertPolicy response = client.GetAlertPolicy(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task UpdateAlertPolicyAsync2() { Mock <AlertPolicyService.AlertPolicyServiceClient> mockGrpcClient = new Mock <AlertPolicyService.AlertPolicyServiceClient>(MockBehavior.Strict); UpdateAlertPolicyRequest request = new UpdateAlertPolicyRequest { AlertPolicy = new AlertPolicy(), }; AlertPolicy expectedResponse = new AlertPolicy { Name = "name3373707", DisplayName = "displayName1615086568", }; mockGrpcClient.Setup(x => x.UpdateAlertPolicyAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <AlertPolicy>(Task.FromResult(expectedResponse), null, null, null, null)); AlertPolicyServiceClient client = new AlertPolicyServiceClientImpl(mockGrpcClient.Object, null); AlertPolicy response = await client.UpdateAlertPolicyAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void UpdateAlertPolicy2() { Mock <AlertPolicyService.AlertPolicyServiceClient> mockGrpcClient = new Mock <AlertPolicyService.AlertPolicyServiceClient>(MockBehavior.Strict); UpdateAlertPolicyRequest request = new UpdateAlertPolicyRequest { AlertPolicy = new AlertPolicy(), }; AlertPolicy expectedResponse = new AlertPolicy { Name = "name3373707", DisplayName = "displayName1615086568", }; mockGrpcClient.Setup(x => x.UpdateAlertPolicy(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); AlertPolicyServiceClient client = new AlertPolicyServiceClientImpl(mockGrpcClient.Object, null); AlertPolicy response = client.UpdateAlertPolicy(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetAlertPolicyAsync2() { Mock <AlertPolicyService.AlertPolicyServiceClient> mockGrpcClient = new Mock <AlertPolicyService.AlertPolicyServiceClient>(MockBehavior.Strict); GetAlertPolicyRequest request = new GetAlertPolicyRequest { AlertPolicyName = new AlertPolicyName("[PROJECT]", "[ALERT_POLICY]"), }; AlertPolicy expectedResponse = new AlertPolicy { Name = "name2-1052831874", DisplayName = "displayName1615086568", }; mockGrpcClient.Setup(x => x.GetAlertPolicyAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <AlertPolicy>(Task.FromResult(expectedResponse), null, null, null, null)); AlertPolicyServiceClient client = new AlertPolicyServiceClientImpl(mockGrpcClient.Object, null); AlertPolicy response = await client.GetAlertPolicyAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task CreateAlertPolicyAsync() { Mock <AlertPolicyService.AlertPolicyServiceClient> mockGrpcClient = new Mock <AlertPolicyService.AlertPolicyServiceClient>(MockBehavior.Strict); CreateAlertPolicyRequest expectedRequest = new CreateAlertPolicyRequest { ProjectName = new ProjectName("[PROJECT]"), AlertPolicy = new AlertPolicy(), }; AlertPolicy expectedResponse = new AlertPolicy { Name = "name2-1052831874", DisplayName = "displayName1615086568", }; mockGrpcClient.Setup(x => x.CreateAlertPolicyAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <AlertPolicy>(Task.FromResult(expectedResponse), null, null, null, null)); AlertPolicyServiceClient client = new AlertPolicyServiceClientImpl(mockGrpcClient.Object, null); ProjectName name = new ProjectName("[PROJECT]"); AlertPolicy alertPolicy = new AlertPolicy(); AlertPolicy response = await client.CreateAlertPolicyAsync(name, alertPolicy); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }