public void Commit_Marklogic_content_transaction_changes_document()
        {
            var documentName = "test_01";
            var content      = "test_01_value";
            var doc          = MarklogicContent.Xml(documentName, GetTestDocument(documentName, content));

            var rest = new RestConnector(DbConnectionSettings);

            rest.Insert(doc);

            var transaction = rest.BeginTransaction();

            doc = MarklogicContent.Xml(documentName, GetTestDocument(documentName, $"{content}_changed"));
            rest.Insert(doc, transaction);
            rest.CommitTransaction(transaction);

            var query    = $"xquery version '1.0-ml'; fn:doc('/{documentName}.xml')";
            var response = rest.Submit(query);
            var actual   = response.Content.ReadAsMultipartAsync().Result.Contents[0].ReadAsStringAsync().Result;
            var expected = MarklogicContent.Xml(documentName, GetTestDocumentXml(documentName, $"{content}_changed")).Content;

            Assert.IsTrue(actual.Equals(expected));
        }
Ejemplo n.º 2
0
 public void Dispose()
 {
     _restConnector.CommitTransaction(_transaction);
 }