public async stt::Task AnalyzeMoveRequestObjectAsync() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); AnalyzeMoveRequest request = new AnalyzeMoveRequest { Resource = "resource164eab96", DestinationParent = "destination_parent29fce40d", View = AnalyzeMoveRequest.Types.AnalysisView.Full, }; AnalyzeMoveResponse expectedResponse = new AnalyzeMoveResponse { MoveAnalysis = { new MoveAnalysis(), }, }; mockGrpcClient.Setup(x => x.AnalyzeMoveAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <AnalyzeMoveResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); AnalyzeMoveResponse responseCallSettings = await client.AnalyzeMoveAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); AnalyzeMoveResponse responseCancellationToken = await client.AnalyzeMoveAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); 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 async Task CreateFeedAsync2() { Mock <AssetService.AssetServiceClient> mockGrpcClient = new Mock <AssetService.AssetServiceClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); CreateFeedRequest request = new CreateFeedRequest { Parent = "parent-995424086", FeedId = "feedId-976011428", Feed = new Feed(), }; Feed expectedResponse = new Feed { Name = "name3373707", }; mockGrpcClient.Setup(x => x.CreateFeedAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Feed>(Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); Feed response = await client.CreateFeedAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetAssetRequestObjectAsync() { 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.GetAssetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::Asset>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); gagvr::Asset responseCallSettings = await client.GetAssetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); gagvr::Asset responseCancellationToken = await client.GetAssetAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void AnalyzeIamPolicyRequestObject() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); AnalyzeIamPolicyRequest request = new AnalyzeIamPolicyRequest { AnalysisQuery = new IamPolicyAnalysisQuery(), Options = new AnalyzeIamPolicyRequest.Types.Options(), }; AnalyzeIamPolicyResponse expectedResponse = new AnalyzeIamPolicyResponse { MainAnalysis = new AnalyzeIamPolicyResponse.Types.IamPolicyAnalysis(), ServiceAccountImpersonationAnalysis = { new AnalyzeIamPolicyResponse.Types.IamPolicyAnalysis(), }, FullyExplored = false, NonCriticalErrors = { new IamPolicyAnalysisResult.Types.AnalysisState(), }, }; mockGrpcClient.Setup(x => x.AnalyzeIamPolicy(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); AnalyzeIamPolicyResponse response = client.AnalyzeIamPolicy(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateAssetsRequestObject() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); MutateAssetsRequest request = new MutateAssetsRequest { CustomerId = "customer_id3b3724cb", Operations = { new AssetOperation(), }, ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly, }; MutateAssetsResponse expectedResponse = new MutateAssetsResponse { Results = { new MutateAssetResult(), }, }; mockGrpcClient.Setup(x => x.MutateAssets(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); MutateAssetsResponse response = client.MutateAssets(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task MutateAssetsAsync() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); MutateAssetsRequest request = new MutateAssetsRequest { CustomerId = "customer_id3b3724cb", Operations = { new AssetOperation(), }, }; MutateAssetsResponse expectedResponse = new MutateAssetsResponse { Results = { new MutateAssetResult(), }, }; mockGrpcClient.Setup(x => x.MutateAssetsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateAssetsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); MutateAssetsResponse responseCallSettings = await client.MutateAssetsAsync(request.CustomerId, request.Operations, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); MutateAssetsResponse responseCancellationToken = await client.MutateAssetsAsync(request.CustomerId, request.Operations, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async stt::Task MutateAssetsRequestObjectAsync() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); MutateAssetsRequest request = new MutateAssetsRequest { CustomerId = "customer_id3b3724cb", Operations = { new AssetOperation(), }, ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly, ValidateOnly = true, PartialFailure = false, }; MutateAssetsResponse expectedResponse = new MutateAssetsResponse { Results = { new MutateAssetResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateAssetsAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateAssetsResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); MutateAssetsResponse responseCallSettings = await client.MutateAssetsAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); MutateAssetsResponse responseCancellationToken = await client.MutateAssetsAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void MutateAssets() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); MutateAssetsRequest request = new MutateAssetsRequest { CustomerId = "customer_id3b3724cb", Operations = { new AssetOperation(), }, }; MutateAssetsResponse expectedResponse = new MutateAssetsResponse { Results = { new MutateAssetResult(), }, }; mockGrpcClient.Setup(x => x.MutateAssets(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); MutateAssetsResponse response = client.MutateAssets(request.CustomerId, request.Operations); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void UpdateFeed() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); UpdateFeedRequest request = new UpdateFeedRequest { Feed = new Feed(), }; Feed expectedResponse = new Feed { FeedName = FeedName.FromProjectFeed("[PROJECT]", "[FEED]"), AssetNames = { "asset_namese42cd316", }, AssetTypes = { "asset_types44c0f429", }, ContentType = ContentType.AccessPolicy, FeedOutputConfig = new FeedOutputConfig(), Condition = new gt::Expr(), RelationshipTypes = { "relationship_typesfb911a9b", }, }; mockGrpcClient.Setup(x => x.UpdateFeed(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); Feed response = client.UpdateFeed(request.Feed); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void BatchGetAssetsHistoryRequestObject() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); BatchGetAssetsHistoryRequest request = new BatchGetAssetsHistoryRequest { ParentAsResourceName = new gax::UnparsedResourceName("a/wildcard/resource"), AssetNames = { "asset_namese42cd316", }, ContentType = ContentType.AccessPolicy, ReadTimeWindow = new TimeWindow(), RelationshipTypes = { "relationship_typesfb911a9b", }, }; BatchGetAssetsHistoryResponse expectedResponse = new BatchGetAssetsHistoryResponse { Assets = { new TemporalAsset(), }, }; mockGrpcClient.Setup(x => x.BatchGetAssetsHistory(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); BatchGetAssetsHistoryResponse response = client.BatchGetAssetsHistory(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task AnalyzeIamPolicyRequestObjectAsync() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); AnalyzeIamPolicyRequest request = new AnalyzeIamPolicyRequest { AnalysisQuery = new IamPolicyAnalysisQuery(), Options = new AnalyzeIamPolicyRequest.Types.Options(), }; AnalyzeIamPolicyResponse expectedResponse = new AnalyzeIamPolicyResponse { MainAnalysis = new AnalyzeIamPolicyResponse.Types.IamPolicyAnalysis(), ServiceAccountImpersonationAnalysis = { new AnalyzeIamPolicyResponse.Types.IamPolicyAnalysis(), }, FullyExplored = false, NonCriticalErrors = { new IamPolicyAnalysisResult.Types.AnalysisState(), }, }; mockGrpcClient.Setup(x => x.AnalyzeIamPolicyAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <AnalyzeIamPolicyResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); AnalyzeIamPolicyResponse responseCallSettings = await client.AnalyzeIamPolicyAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); AnalyzeIamPolicyResponse responseCancellationToken = await client.AnalyzeIamPolicyAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
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 async stt::Task UpdateFeedAsync() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); UpdateFeedRequest request = new UpdateFeedRequest { Feed = new Feed(), }; Feed expectedResponse = new Feed { FeedName = FeedName.FromProjectFeed("[PROJECT]", "[FEED]"), AssetNames = { "asset_namese42cd316", }, AssetTypes = { "asset_types44c0f429", }, ContentType = ContentType.IamPolicy, FeedOutputConfig = new FeedOutputConfig(), Condition = new gt::Expr(), }; mockGrpcClient.Setup(x => x.UpdateFeedAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Feed>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); Feed responseCallSettings = await client.UpdateFeedAsync(request.Feed, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Feed responseCancellationToken = await client.UpdateFeedAsync(request.Feed, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public async stt::Task BatchGetAssetsHistoryRequestObjectAsync() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); BatchGetAssetsHistoryRequest request = new BatchGetAssetsHistoryRequest { ParentAsResourceName = new gax::UnparsedResourceName("a/wildcard/resource"), AssetNames = { "asset_namese42cd316", }, ContentType = ContentType.IamPolicy, ReadTimeWindow = new TimeWindow(), }; BatchGetAssetsHistoryResponse expectedResponse = new BatchGetAssetsHistoryResponse { Assets = { new TemporalAsset(), }, }; mockGrpcClient.Setup(x => x.BatchGetAssetsHistoryAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <BatchGetAssetsHistoryResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); BatchGetAssetsHistoryResponse responseCallSettings = await client.BatchGetAssetsHistoryAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); BatchGetAssetsHistoryResponse responseCancellationToken = await client.BatchGetAssetsHistoryAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void CreateFeedRequestObject() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); CreateFeedRequest request = new CreateFeedRequest { Parent = "parent7858e4d0", FeedId = "feed_id938e5ac9", Feed = new Feed(), }; Feed expectedResponse = new Feed { FeedName = FeedName.FromProjectFeed("[PROJECT]", "[FEED]"), AssetNames = { "asset_namese42cd316", }, AssetTypes = { "asset_types44c0f429", }, ContentType = ContentType.IamPolicy, FeedOutputConfig = new FeedOutputConfig(), Condition = new gt::Expr(), }; mockGrpcClient.Setup(x => x.CreateFeed(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); Feed response = client.CreateFeed(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetAssetRequestObjectAsync() { 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.GetAssetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::Asset>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); gagvr::Asset responseCallSettings = await client.GetAssetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); gagvr::Asset responseCancellationToken = await client.GetAssetAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); 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.MediaBundle, 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(), }; 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 async Task MutateAssetsAsync2() { Mock <AssetService.AssetServiceClient> mockGrpcClient = new Mock <AssetService.AssetServiceClient>(MockBehavior.Strict); MutateAssetsRequest request = new MutateAssetsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateAssetsResponse expectedResponse = new MutateAssetsResponse(); mockGrpcClient.Setup(x => x.MutateAssetsAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MutateAssetsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); MutateAssetsResponse response = await client.MutateAssetsAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void DeleteFeedResourceNames() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); DeleteFeedRequest request = new DeleteFeedRequest { FeedName = FeedName.FromProjectFeed("[PROJECT]", "[FEED]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteFeed(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); client.DeleteFeed(request.FeedName); mockGrpcClient.VerifyAll(); }
public void MutateAssets2() { Mock <AssetService.AssetServiceClient> mockGrpcClient = new Mock <AssetService.AssetServiceClient>(MockBehavior.Strict); MutateAssetsRequest request = new MutateAssetsRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateAssetsResponse expectedResponse = new MutateAssetsResponse(); mockGrpcClient.Setup(x => x.MutateAssets(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); MutateAssetsResponse response = client.MutateAssets(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void DeleteFeed2() { Mock <AssetService.AssetServiceClient> mockGrpcClient = new Mock <AssetService.AssetServiceClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); DeleteFeedRequest request = new DeleteFeedRequest { Name = new FeedName("[PROJECT]", "[FEED]").ToString(), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteFeed(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); client.DeleteFeed(request); mockGrpcClient.VerifyAll(); }
public async Task DeleteFeedAsync2() { Mock <AssetService.AssetServiceClient> mockGrpcClient = new Mock <AssetService.AssetServiceClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); DeleteFeedRequest request = new DeleteFeedRequest { Name = new FeedName("[PROJECT]", "[FEED]").ToString(), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteFeedAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); await client.DeleteFeedAsync(request); mockGrpcClient.VerifyAll(); }
public void ListFeeds2() { Mock <AssetService.AssetServiceClient> mockGrpcClient = new Mock <AssetService.AssetServiceClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); ListFeedsRequest request = new ListFeedsRequest { Parent = "parent-995424086", }; ListFeedsResponse expectedResponse = new ListFeedsResponse(); mockGrpcClient.Setup(x => x.ListFeeds(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); ListFeedsResponse response = client.ListFeeds(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task ListFeedsAsync2() { Mock <AssetService.AssetServiceClient> mockGrpcClient = new Mock <AssetService.AssetServiceClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); ListFeedsRequest request = new ListFeedsRequest { Parent = "parent-995424086", }; ListFeedsResponse expectedResponse = new ListFeedsResponse(); mockGrpcClient.Setup(x => x.ListFeedsAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <ListFeedsResponse>(Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); ListFeedsResponse response = await client.ListFeedsAsync(request); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
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(); }
public void ListFeeds() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); ListFeedsRequest request = new ListFeedsRequest { Parent = "parent7858e4d0", }; ListFeedsResponse expectedResponse = new ListFeedsResponse { Feeds = { new Feed(), }, }; mockGrpcClient.Setup(x => x.ListFeeds(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); ListFeedsResponse response = client.ListFeeds(request.Parent); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task DeleteFeedResourceNamesAsync() { moq::Mock <AssetService.AssetServiceClient> mockGrpcClient = new moq::Mock <AssetService.AssetServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); DeleteFeedRequest request = new DeleteFeedRequest { FeedName = FeedName.FromProjectFeed("[PROJECT]", "[FEED]"), }; wkt::Empty expectedResponse = new wkt::Empty { }; mockGrpcClient.Setup(x => x.DeleteFeedAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <wkt::Empty>(stt::Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); await client.DeleteFeedAsync(request.FeedName, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); await client.DeleteFeedAsync(request.FeedName, st::CancellationToken.None); mockGrpcClient.VerifyAll(); }
public async Task GetAssetAsync2() { 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.GetAssetAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Asset>(Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); Asset response = await client.GetAssetAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task BatchGetAssetsHistoryAsync() { Mock <AssetService.AssetServiceClient> mockGrpcClient = new Mock <AssetService.AssetServiceClient>(MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()) .Returns(new Mock <Operations.OperationsClient>().Object); BatchGetAssetsHistoryRequest expectedRequest = new BatchGetAssetsHistoryRequest { Parent = new Google.Api.Gax.ResourceNames.ProjectName("[PROJECT]").ToString(), }; BatchGetAssetsHistoryResponse expectedResponse = new BatchGetAssetsHistoryResponse(); mockGrpcClient.Setup(x => x.BatchGetAssetsHistoryAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <BatchGetAssetsHistoryResponse>(Task.FromResult(expectedResponse), null, null, null, null)); AssetServiceClient client = new AssetServiceClientImpl(mockGrpcClient.Object, null); string formattedParent = new Google.Api.Gax.ResourceNames.ProjectName("[PROJECT]").ToString(); BatchGetAssetsHistoryResponse response = await client.BatchGetAssetsHistoryAsync(formattedParent); Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }