Exemple #1
0
        public async stt::Task GetCampaignSharedSetRequestObjectAsync()
        {
            moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new moq::Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(moq::MockBehavior.Strict);
            GetCampaignSharedSetRequest request = new GetCampaignSharedSetRequest
            {
                ResourceNameAsCampaignSharedSetName = gagvr::CampaignSharedSetName.FromCustomerCampaignSharedSet("[CUSTOMER]", "[CAMPAIGN_SHARED_SET]"),
            };
            gagvr::CampaignSharedSet expectedResponse = new gagvr::CampaignSharedSet
            {
                ResourceNameAsCampaignSharedSetName = gagvr::CampaignSharedSetName.FromCustomerCampaignSharedSet("[CUSTOMER]", "[CAMPAIGN_SHARED_SET]"),
                Status = gagve::CampaignSharedSetStatusEnum.Types.CampaignSharedSetStatus.Enabled,
                CampaignAsCampaignName   = gagvr::CampaignName.FromCustomerCampaign("[CUSTOMER]", "[CAMPAIGN]"),
                SharedSetAsSharedSetName = gagvr::SharedSetName.FromCustomerSharedSet("[CUSTOMER]", "[SHARED_SET]"),
            };

            mockGrpcClient.Setup(x => x.GetCampaignSharedSetAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <gagvr::CampaignSharedSet>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            CampaignSharedSetServiceClient client = new CampaignSharedSetServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CampaignSharedSet       responseCallSettings = await client.GetCampaignSharedSetAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            Assert.AreEqual(expectedResponse, responseCallSettings);
            gagvr::CampaignSharedSet responseCancellationToken = await client.GetCampaignSharedSetAsync(request, st::CancellationToken.None);

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
        public async Task GetCampaignSharedSetAsync2()
        {
            Mock <CampaignSharedSetService.CampaignSharedSetServiceClient> mockGrpcClient = new Mock <CampaignSharedSetService.CampaignSharedSetServiceClient>(MockBehavior.Strict);
            GetCampaignSharedSetRequest request = new GetCampaignSharedSetRequest
            {
                ResourceName = new CampaignSharedSetName("[CUSTOMER]", "[CAMPAIGN_SHARED_SET]").ToString(),
            };
            CampaignSharedSet expectedResponse = new CampaignSharedSet
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetCampaignSharedSetAsync(request, It.IsAny <CallOptions>()))
            .Returns(new Grpc.Core.AsyncUnaryCall <CampaignSharedSet>(Task.FromResult(expectedResponse), null, null, null, null));
            CampaignSharedSetServiceClient client = new CampaignSharedSetServiceClientImpl(mockGrpcClient.Object, null);
            CampaignSharedSet response            = await client.GetCampaignSharedSetAsync(request);

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