コード例 #1
0
        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();
        }