Exemple #1
0
        public void Method2ResourceNames()
        {
            moq::Mock <Keywords.KeywordsClient> mockGrpcClient = new moq::Mock <Keywords.KeywordsClient>(moq::MockBehavior.Strict);
            Resource request = new Resource
            {
                WhileAsResourceName = ResourceName.FromItem("[ITEM_ID]"),
                Enum = Enum.For,
            };
            Response expectedResponse = new Response {
            };

            mockGrpcClient.Setup(x => x.Method2(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            KeywordsClient client   = new KeywordsClientImpl(mockGrpcClient.Object, null);
            Response       response = client.Method2(request.WhileAsResourceName, request.Enum);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #2
0
        public void Method1()
        {
            moq::Mock <Keywords.KeywordsClient> mockGrpcClient = new moq::Mock <Keywords.KeywordsClient>(moq::MockBehavior.Strict);
            Request request = new Request
            {
                EventAsResourceName = ResourceName.FromItem("[ITEM_ID]"),
                Switch   = -1514770765,
                Void     = Enum.Foreach,
                Request_ = "request873b5710",
                Types_   = "types22804ad1",
            };
            Response expectedResponse = new Response {
            };

            mockGrpcClient.Setup(x => x.Method1(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            KeywordsClient client   = new KeywordsClientImpl(mockGrpcClient.Object, null);
            Response       response = client.Method1(request.Event, request.Switch, request.Void, request.Request_, request.Types_);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Exemple #3
0
        public async stt::Task Method2ResourceNamesAsync()
        {
            moq::Mock <Keywords.KeywordsClient> mockGrpcClient = new moq::Mock <Keywords.KeywordsClient>(moq::MockBehavior.Strict);
            Resource request = new Resource
            {
                WhileAsResourceName = ResourceName.FromItem("[ITEM_ID]"),
                Enum = Enum.For,
            };
            Response expectedResponse = new Response {
            };

            mockGrpcClient.Setup(x => x.Method2Async(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Response>(stt::Task.FromResult(expectedResponse), null, null, null, null));
            KeywordsClient client = new KeywordsClientImpl(mockGrpcClient.Object, null);
            Response       responseCallSettings = await client.Method2Async(request.WhileAsResourceName, request.Enum, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None));

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Response responseCancellationToken = await client.Method2Async(request.WhileAsResourceName, request.Enum, st::CancellationToken.None);

            xunit::Assert.Same(expectedResponse, responseCancellationToken);
            mockGrpcClient.VerifyAll();
        }
Exemple #4
0
        public async stt::Task Method1RequestObjectAsync()
        {
            moq::Mock <Keywords.KeywordsClient> mockGrpcClient = new moq::Mock <Keywords.KeywordsClient>(moq::MockBehavior.Strict);
            Request request = new Request
            {
                EventAsResourceName = ResourceName.FromItem("[ITEM_ID]"),
                Switch   = -1514770765,
                Void     = Enum.Foreach,
                Request_ = "request873b5710",
                Types_   = "types22804ad1",
            };
            Response expectedResponse = new Response {
            };

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

            xunit::Assert.Same(expectedResponse, responseCallSettings);
            Response responseCancellationToken = await client.Method1Async(request, st::CancellationToken.None);

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