Exemplo n.º 1
0
        public async stt::Task GetCarrierConstantRequestObjectAsync()
        {
            moq::Mock <CarrierConstantService.CarrierConstantServiceClient> mockGrpcClient = new moq::Mock <CarrierConstantService.CarrierConstantServiceClient>(moq::MockBehavior.Strict);
            GetCarrierConstantRequest request = new GetCarrierConstantRequest
            {
                ResourceNameAsCarrierConstantName = gagvr::CarrierConstantName.FromCarrierConstant("[CARRIER_CONSTANT]"),
            };
            gagvr::CarrierConstant expectedResponse = new gagvr::CarrierConstant
            {
                ResourceNameAsCarrierConstantName = gagvr::CarrierConstantName.FromCarrierConstant("[CARRIER_CONSTANT]"),
                Id = -6774108720365892680L,
                CarrierConstantName = gagvr::CarrierConstantName.FromCarrierConstant("[CARRIER_CONSTANT]"),
                CountryCode         = "country_code8debec55",
            };

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

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

            Assert.AreEqual(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemplo n.º 2
0
        public void GetCarrierConstant()
        {
            moq::Mock <CarrierConstantService.CarrierConstantServiceClient> mockGrpcClient = new moq::Mock <CarrierConstantService.CarrierConstantServiceClient>(moq::MockBehavior.Strict);
            GetCarrierConstantRequest request = new GetCarrierConstantRequest
            {
                ResourceNameAsCarrierConstantName = gagvr::CarrierConstantName.FromCarrierConstant("[CARRIER_CONSTANT]"),
            };
            gagvr::CarrierConstant expectedResponse = new gagvr::CarrierConstant
            {
                ResourceNameAsCarrierConstantName = gagvr::CarrierConstantName.FromCarrierConstant("[CARRIER_CONSTANT]"),
                Id = -6774108720365892680L,
                CarrierConstantName = gagvr::CarrierConstantName.FromCarrierConstant("[CARRIER_CONSTANT]"),
                CountryCode         = "country_code8debec55",
            };

            mockGrpcClient.Setup(x => x.GetCarrierConstant(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            CarrierConstantServiceClient client   = new CarrierConstantServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::CarrierConstant       response = client.GetCarrierConstant(request.ResourceName);

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