예제 #1
0
        public void GetAsset()
        {
            moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict);
            GetAssetRequest request = new GetAssetRequest
            {
                ResourceNameAsAssetName = gagvr::AssetName.FromCustomerAsset("[CUSTOMER]", "[ASSET]"),
            };
            gagvr::Asset expectedResponse = new gagvr::Asset
            {
                ResourceNameAsAssetName = gagvr::AssetName.FromCustomerAsset("[CUSTOMER]", "[ASSET]"),
                Id                = -6774108720365892680L,
                AssetName         = gagvr::AssetName.FromCustomerAsset("[CUSTOMER]", "[ASSET]"),
                Type              = gagve::AssetTypeEnum.Types.AssetType.Image,
                YoutubeVideoAsset = new gagvc::YoutubeVideoAsset(),
                MediaBundleAsset  = new gagvc::MediaBundleAsset(),
                ImageAsset        = new gagvc::ImageAsset(),
                TextAsset         = new gagvc::TextAsset(),
                BookOnGoogleAsset = new gagvc::BookOnGoogleAsset(),
            };

            mockGrpcClient.Setup(x => x.GetAsset(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AssetServiceClient client   = new AssetServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::Asset       response = client.GetAsset(request.ResourceName);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetAssetRequestObject()
        {
            moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict);
            GetAssetRequest request = new GetAssetRequest
            {
                ResourceNameAsAssetName = gagvr::AssetName.FromCustomerAsset("[CUSTOMER_ID]", "[ASSET_ID]"),
            };
            gagvr::Asset expectedResponse = new gagvr::Asset
            {
                ResourceNameAsAssetName = gagvr::AssetName.FromCustomerAsset("[CUSTOMER_ID]", "[ASSET_ID]"),
                Type = gagve::AssetTypeEnum.Types.AssetType.BookOnGoogle,
                YoutubeVideoAsset = new gagvc::YoutubeVideoAsset(),
                MediaBundleAsset  = new gagvc::MediaBundleAsset(),
                ImageAsset        = new gagvc::ImageAsset(),
                TextAsset         = new gagvc::TextAsset(),
                LeadFormAsset     = new gagvc::LeadFormAsset(),
                BookOnGoogleAsset = new gagvc::BookOnGoogleAsset(),
                Id            = -6774108720365892680L,
                AssetName     = gagvr::AssetName.FromCustomerAsset("[CUSTOMER_ID]", "[ASSET_ID]"),
                PolicySummary = new gagvr::AssetPolicySummary(),
                FinalUrls     =
                {
                    "final_urls3ed0b71b",
                },
            };

            mockGrpcClient.Setup(x => x.GetAsset(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AssetServiceClient client   = new AssetServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::Asset       response = client.GetAsset(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void GetAssetRequestObject()
        {
            moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict);
            GetAssetRequest request = new GetAssetRequest
            {
                ResourceNameAsAssetName = gagvr::AssetName.FromCustomerAsset("[CUSTOMER_ID]", "[ASSET_ID]"),
            };
            gagvr::Asset expectedResponse = new gagvr::Asset
            {
                ResourceNameAsAssetName = gagvr::AssetName.FromCustomerAsset("[CUSTOMER_ID]", "[ASSET_ID]"),
                Type = gagve::AssetTypeEnum.Types.AssetType.LeadForm,
                YoutubeVideoAsset = new gagvc::YoutubeVideoAsset(),
                MediaBundleAsset  = new gagvc::MediaBundleAsset(),
                ImageAsset        = new gagvc::ImageAsset(),
                TextAsset         = new gagvc::TextAsset(),
                LeadFormAsset     = new gagvc::LeadFormAsset(),
                BookOnGoogleAsset = new gagvc::BookOnGoogleAsset(),
                Id            = -6774108720365892680L,
                AssetName     = gagvr::AssetName.FromCustomerAsset("[CUSTOMER_ID]", "[ASSET_ID]"),
                PolicySummary = new gagvr::AssetPolicySummary(),
                FinalUrls     =
                {
                    "final_urls3ed0b71b",
                },
                PromotionAsset  = new gagvc::PromotionAsset(),
                FinalMobileUrls =
                {
                    "final_mobile_urlsf4131aa0",
                },
                TrackingUrlTemplate = "tracking_url_template157f152a",
                UrlCustomParameters =
                {
                    new gagvc::CustomParameter(),
                },
                FinalUrlSuffix         = "final_url_suffix046ed37a",
                CalloutAsset           = new gagvc::CalloutAsset(),
                StructuredSnippetAsset = new gagvc::StructuredSnippetAsset(),
                SitelinkAsset          = new gagvc::SitelinkAsset(),
                PageFeedAsset          = new gagvc::PageFeedAsset(),
                DynamicEducationAsset  = new gagvc::DynamicEducationAsset(),
                MobileAppAsset         = new gagvc::MobileAppAsset(),
                HotelCalloutAsset      = new gagvc::HotelCalloutAsset(),
                CallAsset         = new gagvc::CallAsset(),
                PriceAsset        = new gagvc::PriceAsset(),
                CallToActionAsset = new gagvc::CallToActionAsset(),
            };

            mockGrpcClient.Setup(x => x.GetAsset(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            AssetServiceClient client   = new AssetServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::Asset       response = client.GetAsset(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
예제 #4
0
        public void GetAsset2()
        {
            Mock <AssetService.AssetServiceClient> mockGrpcClient = new Mock <AssetService.AssetServiceClient>(MockBehavior.Strict);
            GetAssetRequest request = new GetAssetRequest
            {
                ResourceName = new AssetName("[CUSTOMER]", "[ASSET]").ToString(),
            };
            Asset expectedResponse = new Asset
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetAsset(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null);
            Asset response            = client.GetAsset(request);

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