public void GetSharedCriterion() { moq::Mock <SharedCriterionService.SharedCriterionServiceClient> mockGrpcClient = new moq::Mock <SharedCriterionService.SharedCriterionServiceClient>(moq::MockBehavior.Strict); GetSharedCriterionRequest request = new GetSharedCriterionRequest { ResourceNameAsSharedCriterionName = gagvr::SharedCriterionName.FromCustomerSharedCriterion("[CUSTOMER]", "[SHARED_CRITERION]"), }; gagvr::SharedCriterion expectedResponse = new gagvr::SharedCriterion { ResourceNameAsSharedCriterionName = gagvr::SharedCriterionName.FromCustomerSharedCriterion("[CUSTOMER]", "[SHARED_CRITERION]"), SharedSetAsSharedSetName = gagvr::SharedSetName.FromCustomerSharedSet("[CUSTOMER]", "[SHARED_SET]"), Keyword = new gagvc::KeywordInfo(), Type = gagve::CriterionTypeEnum.Types.CriterionType.Location, YoutubeVideo = new gagvc::YouTubeVideoInfo(), YoutubeChannel = new gagvc::YouTubeChannelInfo(), Placement = new gagvc::PlacementInfo(), MobileAppCategory = new gagvc::MobileAppCategoryInfo(), MobileApplication = new gagvc::MobileApplicationInfo(), CriterionId = 8584655242409302840L, }; mockGrpcClient.Setup(x => x.GetSharedCriterion(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SharedCriterionServiceClient client = new SharedCriterionServiceClientImpl(mockGrpcClient.Object, null); gagvr::SharedCriterion response = client.GetSharedCriterion(request.ResourceName); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task GetSharedCriterionRequestObjectAsync() { moq::Mock <SharedCriterionService.SharedCriterionServiceClient> mockGrpcClient = new moq::Mock <SharedCriterionService.SharedCriterionServiceClient>(moq::MockBehavior.Strict); GetSharedCriterionRequest request = new GetSharedCriterionRequest { ResourceNameAsSharedCriterionName = gagvr::SharedCriterionName.FromCustomerSharedCriterion("[CUSTOMER]", "[SHARED_CRITERION]"), }; gagvr::SharedCriterion expectedResponse = new gagvr::SharedCriterion { ResourceNameAsSharedCriterionName = gagvr::SharedCriterionName.FromCustomerSharedCriterion("[CUSTOMER]", "[SHARED_CRITERION]"), SharedSetAsSharedSetName = gagvr::SharedSetName.FromCustomerSharedSet("[CUSTOMER]", "[SHARED_SET]"), Keyword = new gagvc::KeywordInfo(), Type = gagve::CriterionTypeEnum.Types.CriterionType.Location, YoutubeVideo = new gagvc::YouTubeVideoInfo(), YoutubeChannel = new gagvc::YouTubeChannelInfo(), Placement = new gagvc::PlacementInfo(), MobileAppCategory = new gagvc::MobileAppCategoryInfo(), MobileApplication = new gagvc::MobileApplicationInfo(), CriterionId = 8584655242409302840L, }; mockGrpcClient.Setup(x => x.GetSharedCriterionAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::SharedCriterion>(stt::Task.FromResult(expectedResponse), null, null, null, null)); SharedCriterionServiceClient client = new SharedCriterionServiceClientImpl(mockGrpcClient.Object, null); gagvr::SharedCriterion responseCallSettings = await client.GetSharedCriterionAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); gagvr::SharedCriterion responseCancellationToken = await client.GetSharedCriterionAsync(request, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetSharedCriterion</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetSharedCriterionRequestObject() { // Create client SharedCriterionServiceClient sharedCriterionServiceClient = SharedCriterionServiceClient.Create(); // Initialize request argument(s) GetSharedCriterionRequest request = new GetSharedCriterionRequest { ResourceNameAsSharedCriterionName = SharedCriterionName.FromCustomerSharedSetCriterion("[CUSTOMER_ID]", "[SHARED_SET_ID]", "[CRITERION_ID]"), }; // Make the request SharedCriterion response = sharedCriterionServiceClient.GetSharedCriterion(request); }
/// <summary>Snippet for GetSharedCriterionAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task GetSharedCriterionRequestObjectAsync() { // Create client SharedCriterionServiceClient sharedCriterionServiceClient = await SharedCriterionServiceClient.CreateAsync(); // Initialize request argument(s) GetSharedCriterionRequest request = new GetSharedCriterionRequest { ResourceNameAsSharedCriterionName = SharedCriterionName.FromCustomerSharedCriterion("[CUSTOMER]", "[SHARED_CRITERION]"), }; // Make the request SharedCriterion response = await sharedCriterionServiceClient.GetSharedCriterionAsync(request); }
/// <summary>Snippet for GetSharedCriterion</summary> public void GetSharedCriterionRequestObject() { // Snippet: GetSharedCriterion(GetSharedCriterionRequest, CallSettings) // Create client SharedCriterionServiceClient sharedCriterionServiceClient = SharedCriterionServiceClient.Create(); // Initialize request argument(s) GetSharedCriterionRequest request = new GetSharedCriterionRequest { ResourceNameAsSharedCriterionName = SharedCriterionName.FromCustomerSharedCriterion("[CUSTOMER]", "[SHARED_CRITERION]"), }; // Make the request SharedCriterion response = sharedCriterionServiceClient.GetSharedCriterion(request); // End snippet }
/// <summary>Snippet for GetSharedCriterionAsync</summary> public async Task GetSharedCriterionRequestObjectAsync() { // Snippet: GetSharedCriterionAsync(GetSharedCriterionRequest, CallSettings) // Additional: GetSharedCriterionAsync(GetSharedCriterionRequest, CancellationToken) // Create client SharedCriterionServiceClient sharedCriterionServiceClient = await SharedCriterionServiceClient.CreateAsync(); // Initialize request argument(s) GetSharedCriterionRequest request = new GetSharedCriterionRequest { ResourceNameAsSharedCriterionName = SharedCriterionName.FromCustomerSharedCriterion("[CUSTOMER]", "[SHARED_CRITERION]"), }; // Make the request SharedCriterion response = await sharedCriterionServiceClient.GetSharedCriterionAsync(request); // End snippet }
public void GetSharedCriterion2() { Mock <SharedCriterionService.SharedCriterionServiceClient> mockGrpcClient = new Mock <SharedCriterionService.SharedCriterionServiceClient>(MockBehavior.Strict); GetSharedCriterionRequest request = new GetSharedCriterionRequest { ResourceName = new SharedCriteriaName("[CUSTOMER]", "[SHARED_CRITERIA]").ToString(), }; SharedCriterion expectedResponse = new SharedCriterion { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetSharedCriterion(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); SharedCriterionServiceClient client = new SharedCriterionServiceClientImpl(mockGrpcClient.Object, null); SharedCriterion response = client.GetSharedCriterion(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task GetSharedCriterionAsync2() { Mock <SharedCriterionService.SharedCriterionServiceClient> mockGrpcClient = new Mock <SharedCriterionService.SharedCriterionServiceClient>(MockBehavior.Strict); GetSharedCriterionRequest request = new GetSharedCriterionRequest { ResourceName = new SharedCriteriaName("[CUSTOMER]", "[SHARED_CRITERIA]").ToString(), }; SharedCriterion expectedResponse = new SharedCriterion { ResourceName = "resourceName2625949903", }; mockGrpcClient.Setup(x => x.GetSharedCriterionAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <SharedCriterion>(Task.FromResult(expectedResponse), null, null, null, null)); SharedCriterionServiceClient client = new SharedCriterionServiceClientImpl(mockGrpcClient.Object, null); SharedCriterion response = await client.GetSharedCriterionAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }