コード例 #1
0
        public void Commit3()
        {
            Mock <Spanner.SpannerClient> mockGrpcClient = new Mock <Spanner.SpannerClient>(MockBehavior.Strict);
            CommitRequest request = new CommitRequest
            {
                SessionAsSessionName = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"),
                Mutations            = { },
            };
            CommitResponse expectedResponse = new CommitResponse();

            mockGrpcClient.Setup(x => x.Commit(request, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            SpannerClient  client   = new SpannerClientImpl(mockGrpcClient.Object, null);
            CommitResponse response = client.Commit(request);

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
コード例 #2
0
        public void Commit2()
        {
            Mock <Spanner.SpannerClient> mockGrpcClient = new Mock <Spanner.SpannerClient>(MockBehavior.Strict);
            CommitRequest expectedRequest = new CommitRequest
            {
                SessionAsSessionName = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"),
                SingleUseTransaction = new TransactionOptions(),
                Mutations            = { },
            };
            CommitResponse expectedResponse = new CommitResponse();

            mockGrpcClient.Setup(x => x.Commit(expectedRequest, It.IsAny <CallOptions>()))
            .Returns(expectedResponse);
            SpannerClient          client  = new SpannerClientImpl(mockGrpcClient.Object, null);
            SessionName            session = new SessionName("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]");
            TransactionOptions     singleUseTransaction = new TransactionOptions();
            IEnumerable <Mutation> mutations            = new List <Mutation>();
            CommitResponse         response             = client.Commit(session, singleUseTransaction, mutations);

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