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(); }
public async stt::Task MutateSharedCriteriaAsync() { moq::Mock <SharedCriterionService.SharedCriterionServiceClient> mockGrpcClient = new moq::Mock <SharedCriterionService.SharedCriterionServiceClient>(moq::MockBehavior.Strict); MutateSharedCriteriaRequest request = new MutateSharedCriteriaRequest { CustomerId = "customer_id3b3724cb", Operations = { new SharedCriterionOperation(), }, }; MutateSharedCriteriaResponse expectedResponse = new MutateSharedCriteriaResponse { Results = { new MutateSharedCriterionResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateSharedCriteriaAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MutateSharedCriteriaResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); SharedCriterionServiceClient client = new SharedCriterionServiceClientImpl(mockGrpcClient.Object, null); MutateSharedCriteriaResponse responseCallSettings = await client.MutateSharedCriteriaAsync(request.CustomerId, request.Operations, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); Assert.AreEqual(expectedResponse, responseCallSettings); MutateSharedCriteriaResponse responseCancellationToken = await client.MutateSharedCriteriaAsync(request.CustomerId, request.Operations, st::CancellationToken.None); Assert.AreEqual(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void MutateSharedCriteria() { moq::Mock <SharedCriterionService.SharedCriterionServiceClient> mockGrpcClient = new moq::Mock <SharedCriterionService.SharedCriterionServiceClient>(moq::MockBehavior.Strict); MutateSharedCriteriaRequest request = new MutateSharedCriteriaRequest { CustomerId = "customer_id3b3724cb", Operations = { new SharedCriterionOperation(), }, }; MutateSharedCriteriaResponse expectedResponse = new MutateSharedCriteriaResponse { Results = { new MutateSharedCriterionResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateSharedCriteria(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SharedCriterionServiceClient client = new SharedCriterionServiceClientImpl(mockGrpcClient.Object, null); MutateSharedCriteriaResponse response = client.MutateSharedCriteria(request.CustomerId, request.Operations); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateSharedCriteriaRequestObject() { moq::Mock <SharedCriterionService.SharedCriterionServiceClient> mockGrpcClient = new moq::Mock <SharedCriterionService.SharedCriterionServiceClient>(moq::MockBehavior.Strict); MutateSharedCriteriaRequest request = new MutateSharedCriteriaRequest { CustomerId = "customer_id3b3724cb", Operations = { new SharedCriterionOperation(), }, PartialFailure = false, ValidateOnly = true, ResponseContentType = gagve::ResponseContentTypeEnum.Types.ResponseContentType.ResourceNameOnly, }; MutateSharedCriteriaResponse expectedResponse = new MutateSharedCriteriaResponse { Results = { new MutateSharedCriterionResult(), }, PartialFailureError = new gr::Status(), }; mockGrpcClient.Setup(x => x.MutateSharedCriteria(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SharedCriterionServiceClient client = new SharedCriterionServiceClientImpl(mockGrpcClient.Object, null); MutateSharedCriteriaResponse response = client.MutateSharedCriteria(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async Task MutateSharedCriteriaAsync3() { Mock <SharedCriterionService.SharedCriterionServiceClient> mockGrpcClient = new Mock <SharedCriterionService.SharedCriterionServiceClient>(MockBehavior.Strict); MutateSharedCriteriaRequest request = new MutateSharedCriteriaRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateSharedCriteriaResponse expectedResponse = new MutateSharedCriteriaResponse(); mockGrpcClient.Setup(x => x.MutateSharedCriteriaAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MutateSharedCriteriaResponse>(Task.FromResult(expectedResponse), null, null, null, null)); SharedCriterionServiceClient client = new SharedCriterionServiceClientImpl(mockGrpcClient.Object, null); MutateSharedCriteriaResponse response = await client.MutateSharedCriteriaAsync(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public void MutateSharedCriteria3() { Mock <SharedCriterionService.SharedCriterionServiceClient> mockGrpcClient = new Mock <SharedCriterionService.SharedCriterionServiceClient>(MockBehavior.Strict); MutateSharedCriteriaRequest request = new MutateSharedCriteriaRequest { CustomerId = "customerId-1772061412", Operations = { }, }; MutateSharedCriteriaResponse expectedResponse = new MutateSharedCriteriaResponse(); mockGrpcClient.Setup(x => x.MutateSharedCriteria(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); SharedCriterionServiceClient client = new SharedCriterionServiceClientImpl(mockGrpcClient.Object, null); MutateSharedCriteriaResponse response = client.MutateSharedCriteria(request); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }
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(); }
public async Task MutateSharedCriteriaAsync() { Mock <SharedCriterionService.SharedCriterionServiceClient> mockGrpcClient = new Mock <SharedCriterionService.SharedCriterionServiceClient>(MockBehavior.Strict); MutateSharedCriteriaRequest expectedRequest = new MutateSharedCriteriaRequest { CustomerId = "customerId-1772061412", Operations = { }, PartialFailure = true, ValidateOnly = false, }; MutateSharedCriteriaResponse expectedResponse = new MutateSharedCriteriaResponse(); mockGrpcClient.Setup(x => x.MutateSharedCriteriaAsync(expectedRequest, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <MutateSharedCriteriaResponse>(Task.FromResult(expectedResponse), null, null, null, null)); SharedCriterionServiceClient client = new SharedCriterionServiceClientImpl(mockGrpcClient.Object, null); string customerId = "customerId-1772061412"; IEnumerable <SharedCriterionOperation> operations = new List <SharedCriterionOperation>(); bool partialFailure = true; bool validateOnly = false; MutateSharedCriteriaResponse response = await client.MutateSharedCriteriaAsync(customerId, operations, partialFailure, validateOnly); Assert.AreEqual(expectedResponse, response); mockGrpcClient.VerifyAll(); }