示例#1
0
        public void GetTopicConstant2()
        {
            Mock <TopicConstantService.TopicConstantServiceClient> mockGrpcClient = new Mock <TopicConstantService.TopicConstantServiceClient>(MockBehavior.Strict);
            GetTopicConstantRequest request = new GetTopicConstantRequest
            {
                ResourceName = new TopicConstantName("[TOPIC_CONSTANT]").ToString(),
            };
            TopicConstant expectedResponse = new TopicConstant
            {
                ResourceName = "resourceName2625949903",
            };

            mockGrpcClient.Setup(x => x.GetTopicConstant(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            TopicConstantServiceClient client = new TopicConstantServiceClientImpl(mockGrpcClient.Object, null);
            TopicConstant response            = client.GetTopicConstant(request);

            Assert.AreEqual(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
示例#2
0
        public void GetTopicConstant()
        {
            moq::Mock <TopicConstantService.TopicConstantServiceClient> mockGrpcClient = new moq::Mock <TopicConstantService.TopicConstantServiceClient>(moq::MockBehavior.Strict);
            GetTopicConstantRequest request = new GetTopicConstantRequest
            {
                ResourceNameAsTopicConstantName = gagvr::TopicConstantName.FromTopic("[TOPIC_ID]"),
            };
            gagvr::TopicConstant expectedResponse = new gagvr::TopicConstant
            {
                ResourceNameAsTopicConstantName = gagvr::TopicConstantName.FromTopic("[TOPIC_ID]"),
                Id = -6774108720365892680L,
                TopicConstantParentAsTopicConstantName = gagvr::TopicConstantName.FromTopic("[TOPIC_ID]"),
                Path = { "path0b1dfed6", },
            };

            mockGrpcClient.Setup(x => x.GetTopicConstant(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            TopicConstantServiceClient client   = new TopicConstantServiceClientImpl(mockGrpcClient.Object, null);
            gagvr::TopicConstant       response = client.GetTopicConstant(request.ResourceName);

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