public void Commit2()
        {
            Mock <Firestore.FirestoreClient> mockGrpcClient = new Mock <Firestore.FirestoreClient>(MockBehavior.Strict);
            CommitRequest request = new CommitRequest
            {
                Database = new DatabaseRootName("[PROJECT]", "[DATABASE]").ToString(),
                Writes   = { },
            };
            CommitResponse expectedResponse = new CommitResponse();

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

            Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
Beispiel #2
0
        public void Commit()
        {
            moq::Mock <Firestore.FirestoreClient> mockGrpcClient = new moq::Mock <Firestore.FirestoreClient>(moq::MockBehavior.Strict);
            CommitRequest request = new CommitRequest
            {
                Database = "projects/test/databases/databased8eee011",
                Writes   = { new Write(), },
            };
            CommitResponse expectedResponse = new CommitResponse
            {
                WriteResults = { new WriteResult(), },
                CommitTime   = new wkt::Timestamp(),
            };

            mockGrpcClient.Setup(x => x.Commit(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            FirestoreClient client   = new FirestoreClientImpl(mockGrpcClient.Object, null);
            CommitResponse  response = client.Commit(request.Database, request.Writes);

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