Example #1
0
        public void GetContextRequestObject()
        {
            moq::Mock <Contexts.ContextsClient> mockGrpcClient = new moq::Mock <Contexts.ContextsClient>(moq::MockBehavior.Strict);
            GetContextRequest request = new GetContextRequest
            {
                ContextName = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]"),
            };
            Context expectedResponse = new Context
            {
                ContextName   = ContextName.FromProjectSessionContext("[PROJECT]", "[SESSION]", "[CONTEXT]"),
                LifespanCount = -2034952532,
                Parameters    = new wkt::Struct(),
            };

            mockGrpcClient.Setup(x => x.GetContext(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            ContextsClient client   = new ContextsClientImpl(mockGrpcClient.Object, null);
            Context        response = client.GetContext(request);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Example #2
0
        public void GetContext2()
        {
            Mock <Contexts.ContextsClient> mockGrpcClient = new Mock <Contexts.ContextsClient>(MockBehavior.Strict);
            GetContextRequest request = new GetContextRequest
            {
                ContextName = new ContextName("[PROJECT]", "[SESSION]", "[CONTEXT]"),
            };
            Context expectedResponse = new Context
            {
                ContextName   = new ContextName("[PROJECT]", "[SESSION]", "[CONTEXT]"),
                LifespanCount = 1178775510,
            };

            mockGrpcClient.Setup(x => x.GetContext(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            ContextsClient client   = new ContextsClientImpl(mockGrpcClient.Object, null);
            Context        response = client.GetContext(request);

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