Example #1
0
        public async stt::Task GetLanguageConstantRequestObjectAsync()
        {
            moq::Mock <LanguageConstantService.LanguageConstantServiceClient> mockGrpcClient = new moq::Mock <LanguageConstantService.LanguageConstantServiceClient>(moq::MockBehavior.Strict);
            GetLanguageConstantRequest request = new GetLanguageConstantRequest
            {
                ResourceNameAsLanguageConstantName = gagvr::LanguageConstantName.FromCriterion("[CRITERION_ID]"),
            };
            gagvr::LanguageConstant expectedResponse = new gagvr::LanguageConstant
            {
                ResourceNameAsLanguageConstantName = gagvr::LanguageConstantName.FromCriterion("[CRITERION_ID]"),
                Id   = -6774108720365892680L,
                Code = "code946733c1",
                LanguageConstantName = gagvr::LanguageConstantName.FromCriterion("[CRITERION_ID]"),
                Targetable           = true,
            };

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

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            gagvr::LanguageConstant responseCancellationToken = await client.GetLanguageConstantAsync(request, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Example #2
0
        public void GetLanguageConstant()
        {
            moq::Mock <LanguageConstantService.LanguageConstantServiceClient> mockGrpcClient = new moq::Mock <LanguageConstantService.LanguageConstantServiceClient>(moq::MockBehavior.Strict);
            GetLanguageConstantRequest request = new GetLanguageConstantRequest
            {
                ResourceNameAsLanguageConstantName = gagvr::LanguageConstantName.FromCriterion("[CRITERION_ID]"),
            };
            gagvr::LanguageConstant expectedResponse = new gagvr::LanguageConstant
            {
                ResourceNameAsLanguageConstantName = gagvr::LanguageConstantName.FromCriterion("[CRITERION_ID]"),
                Id   = -6774108720365892680L,
                Code = "code946733c1",
                LanguageConstantName = gagvr::LanguageConstantName.FromCriterion("[CRITERION_ID]"),
                Targetable           = true,
            };

            mockGrpcClient.Setup(x => x.GetLanguageConstant(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            LanguageConstantServiceClient client   = new LanguageConstantServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::LanguageConstant       response = client.GetLanguageConstant(request.ResourceName);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }