Arango.Tests.DocumentOperationsTests.Should_update_document_with_mergeArrays_set_to_true C# (CSharp) Метод

Should_update_document_with_mergeArrays_set_to_true() приватный Метод

private Should_update_document_with_mergeArrays_set_to_true ( ) : void
Результат void
        public void Should_update_document_with_mergeArrays_set_to_true()
        {
            var db = new ADatabase(Database.Alias);

            var newDocument = new Dictionary<string, object>()
                .String("foo", "some string")
                .Document("bar", new Dictionary<string, object>().String("foo", "string value"));

            var createResult = db.Document
                .Create(Database.TestDocumentCollectionName, newDocument);

            newDocument.Merge(createResult.Value);

            var document = new Dictionary<string, object>()
                .String("foo", "some other new string")
                .Document("bar", new Dictionary<string, object>().String("bar", "other string value"));

            var updateResult = db.Document
                .MergeObjects(true) // this is also default behavior
                .Update(newDocument.ID(), document);

            Assert.AreEqual(202, updateResult.StatusCode);
            Assert.IsTrue(updateResult.Success);
            Assert.IsTrue(updateResult.HasValue);
            Assert.AreEqual(updateResult.Value.ID(), newDocument.ID());
            Assert.AreEqual(updateResult.Value.Key(), newDocument.Key());
            Assert.AreNotEqual(updateResult.Value.Rev(), newDocument.Rev());

            var getResult = db.Document
                .Get(updateResult.Value.ID());

            Assert.AreEqual(getResult.Value.ID(), updateResult.Value.ID());
            Assert.AreEqual(getResult.Value.Key(), updateResult.Value.Key());
            Assert.AreEqual(getResult.Value.Rev(), updateResult.Value.Rev());

            Assert.AreNotEqual(getResult.Value.String("foo"), newDocument.String("foo"));
            Assert.AreEqual(getResult.Value.String("foo"), document.String("foo"));

            Assert.IsTrue(getResult.Value.Has("bar.foo"));

            Assert.IsTrue(getResult.Value.Has("bar.bar"));
        }
DocumentOperationsTests