Esempio n. 1
0
        public void UpdateDocument()
        {
            moq::Mock <Firestore.FirestoreClient> mockGrpcClient = new moq::Mock <Firestore.FirestoreClient>(moq::MockBehavior.Strict);
            UpdateDocumentRequest request = new UpdateDocumentRequest
            {
                Document   = new Document(),
                UpdateMask = new DocumentMask(),
            };
            Document expectedResponse = new Document
            {
                Name   = "name1c9368b0",
                Fields =
                {
                    {
                        "key8a0b6e3c",
                        new Value()
                    },
                },
                CreateTime = new wkt::Timestamp(),
                UpdateTime = new wkt::Timestamp(),
            };

            mockGrpcClient.Setup(x => x.UpdateDocument(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse);
            FirestoreClient client   = new FirestoreClientImpl(mockGrpcClient.Object, null);
            Document        response = client.UpdateDocument(request.Document, request.UpdateMask);

            xunit::Assert.Same(expectedResponse, response);
            mockGrpcClient.VerifyAll();
        }
        public void UpdateDocument2()
        {
            Mock <Firestore.FirestoreClient> mockGrpcClient = new Mock <Firestore.FirestoreClient>(MockBehavior.Strict);
            UpdateDocumentRequest            request        = new UpdateDocumentRequest
            {
                Document   = new Document(),
                UpdateMask = new DocumentMask(),
            };
            Document expectedResponse = new Document
            {
                Name = "name3373707",
            };

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

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