public void GetAdParameter2() { Mock <AdParameterService.AdParameterServiceClient> mockGrpcClient = new Mock <AdParameterService.AdParameterServiceClient>(MockBehavior.Strict); GetAdParameterRequest request = new GetAdParameterRequest { ResourceName = new AdParameterName("[CUSTOMER]", "[AD_PARAMETER]").ToString(), }; AdParameter expectedResponse = new AdParameter { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetAdParameter(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); AdParameterServiceClient client = new AdParameterServiceClientImpl(mockGrpcClient.Object, null); AdParameter response = client.GetAdParameter(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void GetAdParameter() { moq::Mock <AdParameterService.AdParameterServiceClient> mockGrpcClient = new moq::Mock <AdParameterService.AdParameterServiceClient>(moq::MockBehavior.Strict); GetAdParameterRequest request = new GetAdParameterRequest { ResourceNameAsAdParameterName = gagvr::AdParameterName.FromCustomerAdGroupCriterionParameterIndex("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]", "[PARAMETER_INDEX]"), }; gagvr::AdParameter expectedResponse = new gagvr::AdParameter { ResourceNameAsAdParameterName = gagvr::AdParameterName.FromCustomerAdGroupCriterionParameterIndex("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]", "[PARAMETER_INDEX]"), AdGroupCriterionAsAdGroupCriterionName = gagvr::AdGroupCriterionName.FromCustomerAdGroupCriterion("[CUSTOMER_ID]", "[AD_GROUP_ID]", "[CRITERION_ID]"), ParameterIndex = 2776974389611536835L, InsertionText = "insertion_text562a41ad", }; mockGrpcClient.Setup(x => x.GetAdParameter(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AdParameterServiceClient client = new AdParameterServiceClientImpl(mockGrpcClient.Object, null); gagvr::AdParameter response = client.GetAdParameter(request.ResourceName); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }