コード例 #1
0
        public void GetGoogleAdsFieldRequestObject()
        {
            moq::Mock <GoogleAdsFieldService.GoogleAdsFieldServiceClient> mockGrpcClient = new moq::Mock <GoogleAdsFieldService.GoogleAdsFieldServiceClient>(moq::MockBehavior.Strict);
            GetGoogleAdsFieldRequest request = new GetGoogleAdsFieldRequest
            {
                ResourceNameAsGoogleAdsFieldName = gagvr::GoogleAdsFieldName.FromGoogleAdsField("[GOOGLE_ADS_FIELD]"),
            };
            gagvr::GoogleAdsField expectedResponse = new gagvr::GoogleAdsField
            {
                ResourceNameAsGoogleAdsFieldName = gagvr::GoogleAdsFieldName.FromGoogleAdsField("[GOOGLE_ADS_FIELD]"),
                Category           = gagve::GoogleAdsFieldCategoryEnum.Types.GoogleAdsFieldCategory.Segment,
                DataType           = gagve::GoogleAdsFieldDataTypeEnum.Types.GoogleAdsFieldDataType.Message,
                GoogleAdsFieldName = gagvr::GoogleAdsFieldName.FromGoogleAdsField("[GOOGLE_ADS_FIELD]"),
                Selectable         = true,
                Filterable         = true,
                Sortable           = true,
                SelectableWith     =
                {
                    "selectable_with6b2ad4c4",
                },
                AttributeResources =
                {
                    "attribute_resources3f8a5e5c",
                },
                Metrics  = { "metrics7cd659aa", },
                Segments =
                {
                    "segments982d981f",
                },
                EnumValues =
                {
                    "enum_values30797dbe",
                },
                TypeUrl    = "type_urlfde5623b",
                IsRepeated = false,
            };

            mockGrpcClient.Setup(x => x.GetGoogleAdsField(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            GoogleAdsFieldServiceClient client   = new GoogleAdsFieldServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::GoogleAdsField       response = client.GetGoogleAdsField(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #2
0
        public void GetGoogleAdsField2()
        {
            Mock <GoogleAdsFieldService.GoogleAdsFieldServiceClient> mockGrpcClient = new Mock <GoogleAdsFieldService.GoogleAdsFieldServiceClient>(MockBehavior.Strict);
            GetGoogleAdsFieldRequest request = new GetGoogleAdsFieldRequest
            {
                ResourceName = new GoogleAdsFieldName("[GOOGLE_ADS_FIELD]").ToString(),
            };
            GoogleAdsField expectedResponse = new GoogleAdsField
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetGoogleAdsField(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            GoogleAdsFieldServiceClient client = new GoogleAdsFieldServiceClientImpl(mockGrpcClient.Object, null);
            GoogleAdsField response            = client.GetGoogleAdsField(request);

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