public void TestDictionaryFragmentSetCSharpDictionary()
        {
            var doc = new MutableDocument("doc1");

            doc["dict"].Value = new Dictionary <string, object> {
                ["name"]    = "Jason",
                ["address"] = new Dictionary <string, object> {
                    ["street"] = "1 Main Street",
                    ["phones"] = new Dictionary <string, object> {
                        ["mobile"] = "650-123-4567"
                    }
                }
            };

            SaveDocument(doc, d =>
            {
                d["dict"]["name"].String.Should().Be("Jason", "because that is what was stored");
                d["dict"]["address"]["street"]
                .String
                .Should()
                .Be("1 Main Street", "because that is what was stored");
                d["dict"]["address"]["phones"]["mobile"]
                .String
                .Should()
                .Be("650-123-4567", "because that is what was stored");
            });
        }
        public void TestGetNestedArrayFragments()
        {
            var nested = new[] { 4L, 5L, 6L };
            var dict   = new Dictionary <string, object> {
                ["nested-array"] = new object[] {
                    new[] { 1, 2, 3 },
                    nested
                }
            };

            var doc = new MutableDocument("doc1", dict);

            SaveDocument(doc, d =>
            {
                var fragment = d["nested-array"][1];
                fragment.Exists.Should().BeTrue("because this portion of the data exists");
                fragment.String.Should().BeNull("because that is the default value");
                fragment.Int.Should().Be(0, "because that is the default value");
                fragment.Long.Should().Be(0L, "because that is the default value");
                fragment.Double.Should().Be(0.0, "because that is the default value");
                fragment.Float.Should().Be(0.0f, "because that is the default value");
                fragment.Boolean.Should().Be(true, "because that is the default value");
                fragment.Date.Should().Be(DateTimeOffset.MinValue, "because that is the default value");
                fragment.Value.Should().NotBeNull("because this fragment has a value");
                fragment.Dictionary.Should().BeNull("because that is the default value");
                fragment.Array.Should().NotBeNull("because this fragment is of this type");
                fragment.Value.As <ArrayObject>()
                .Should()
                .ContainInOrder(fragment.Array,
                                "because both of these accessors should return the same value");
                fragment.Array.Should().ContainInOrder(nested, "because that is what was stored");
                fragment.Array.Count.Should().Be(3, "because there are three elements inside");
            });
        }
        public void TestGetNestedNonExistingArrayFragments()
        {
            var nested = new[] { 1, 2, 3 };
            var dict   = new Dictionary <string, object> {
                ["nested-array"] = new object[] {
                    nested,
                    new[] { 4, 5, 6 }
                }
            };

            var doc = new MutableDocument("doc1", dict);

            SaveDocument(doc, d =>
            {
                var fragment = d["nested-array"][2];
                fragment.Exists.Should().BeFalse("because this portion of the data doesn't exist");
                fragment.String.Should().BeNull("because that is the default value");
                fragment.Array.Should().BeNull("because that is the default value");
                fragment.Int.Should().Be(0, "because that is the default value");
                fragment.Long.Should().Be(0L, "because that is the default value");
                fragment.Double.Should().Be(0.0, "because that is the default value");
                fragment.Float.Should().Be(0.0f, "because that is the default value");
                fragment.Boolean.Should().Be(false, "because that is the default value");
                fragment.Date.Should().Be(DateTimeOffset.MinValue, "because that is the default value");
                fragment.Value.Should().BeNull("because this fragment doesn't have a value");
                fragment.Dictionary.Should().BeNull("because that is the default value");
            });
        }
        private MutableDocument CreateDocumentWithTag(string id, string tag)
        {
            var doc = new MutableDocument(id);

            doc.SetString("tag", tag);

            doc.SetString("firstName", "Daniel");
            doc.SetString("lastName", "Tiger");

            var address = new MutableDictionaryObject();

            address.SetString("street", "1 Main street");
            address.SetString("city", "Mountain View");
            address.SetString("state", "CA");
            doc.SetDictionary("address", address);

            var phones = new MutableArrayObject();

            phones.AddString("650-123-0001").AddString("650-123-0002");
            doc.SetArray("phones", phones);

            doc.SetDate("updated", DateTimeOffset.UtcNow);

            return(doc);
        }
        public void TestGetNestedNonExistingDictionaryFragment()
        {
            var phones = new Dictionary <string, object> {
                ["mobile"] = "650-123-4567"
            };

            var dict = new Dictionary <string, object> {
                ["address"] = new Dictionary <string, object> {
                    ["street"] = "1 Main street",
                    ["phones"] = phones
                }
            };

            var doc = new MutableDocument("doc1", dict);

            SaveDocument(doc, d =>
            {
                var fragment = d["address"]["country"];
                fragment.Exists.Should().BeFalse("because this portion of the data doesn't exist");
                fragment.String.Should().BeNull("because that is the default value");
                fragment.Array.Should().BeNull("because that is the default value");
                fragment.Int.Should().Be(0, "because that is the default value");
                fragment.Long.Should().Be(0L, "because that is the default value");
                fragment.Double.Should().Be(0.0, "because that is the default value");
                fragment.Float.Should().Be(0.0f, "because that is the default value");
                fragment.Boolean.Should().Be(false, "because that is the default value");
                fragment.Date.Should().Be(DateTimeOffset.MinValue, "because that is the default value");
                fragment.Value.Should().BeNull("because this fragment doesn't have a value");
                fragment.Dictionary.Should().BeNull("because that is the default value");
            });
        }
Exemple #6
0
        public void TestMultipleListenersOnSameDatabase()
        {
            _listener = CreateListener();
            var _listener2 = CreateNewListener();

            using (var doc1 = new MutableDocument("doc1"))
                using (var doc2 = new MutableDocument("doc2")) {
                    doc1.SetString("name", "Sam");
                    Db.Save(doc1);
                    doc2.SetString("name", "Mary");
                    OtherDb.Save(doc2);
                }

            RunReplication(
                _listener.LocalEndpoint(),
                ReplicatorType.PushAndPull,
                false,
                null,
                false, //accept only self signed server cert
                _listener.TlsIdentity.Certs[0],
                0,
                0
                );

            _listener.Stop();
            _listener2.Stop();

            OtherDb.Count.Should().Be(2);
        }
        public void TestChannelPull()
        {
            _otherDB.Count.Should().Be(0);
            Db.InBatch(() =>
            {
                for (int i = 0; i < 5; i++)
                {
                    using (var doc = new MutableDocument($"doc-{i}")) {
                        doc["foo"].Value = "bar";
                        Db.Save(doc);
                    }
                }

                for (int i = 0; i < 10; i++)
                {
                    using (var doc = new MutableDocument($"doc-{i+5}")) {
                        doc["channels"].Value = "my_channel";
                        Db.Save(doc);
                    }
                }
            });


            var config = CreateConfig(true, false, false, new URLEndpoint(new Uri("ws://localhost/db")));

            RunReplication(config, 0, 0);

            config = new ReplicatorConfiguration(_otherDB, new URLEndpoint(new Uri("ws://localhost/db")));
            ModifyConfig(config, false, true, false);
            config.Channels = new[] { "my_channel" };
            RunReplication(config, 0, 0);
            _otherDB.Count.Should().Be(10, "because 10 documents should be in the given channel");
        }
        public void TestDocumentIDs()
        {
            using (var doc1 = new MutableDocument("doc1")) {
                doc1.SetString("species", "Tiger");
                doc1.SetString("name", "Hobbes");
                Db.Save(doc1);
            }

            using (var doc2 = new MutableDocument("doc2")) {
                doc2.SetString("species", "Tiger");
                doc2.SetString("pattern", "striped");
                Db.Save(doc2);
            }

            var config = CreateConfig(true, false, false);

            config.DocumentIDs = new[] { "doc1" };
            RunReplication(config, 0, 0);

            _otherDB.Count.Should().Be(1UL);
            using (var doc1 = _otherDB.GetDocument("doc1")) {
                doc1.Should().NotBeNull();
                doc1.GetString("species").Should().Be("Tiger");
                doc1.GetString("name").Should().Be("Hobbes");
            }
        }
        public void TestNonSupportedInput()
        {
            var echoModel = new EchoModel();

            echoModel.RegisterModel();

            var model      = nameof(EchoModel);
            var input      = Expression.Value("string");
            var prediction = Function.Prediction(model, input);

            //Due to possibility of optimization on new SQLite, SQLite skips these expensive query calls if there is no document before running a query.
            using (var doc = new MutableDocument()) {
                doc.SetInt("number", 1);
                SaveDocument(doc);
            }

            using (var q = QueryBuilder.Select(SelectResult.Expression(prediction))
                           .From(DataSource.Database(Db))) {
                q.Invoking(x => x.Execute()).Should().Throw <CouchbaseSQLiteException>()
                .Where(x => x.BaseError == SQLiteStatus.Error);
            }

            var dict = new Dictionary <string, object> {
                ["key"] = this
            };

            input      = Expression.Dictionary(dict);
            prediction = Function.Prediction(model, input);

            using (var q = QueryBuilder.Select(SelectResult.Expression(prediction))
                           .From(DataSource.Database(Db))) {
                q.Invoking(x => x.Execute()).Should().Throw <ArgumentException>();
            }
        }
 private void CreateDocument(params int[] numbers)
 {
     using (var doc = new MutableDocument()) {
         doc.SetValue("numbers", numbers);
         SaveDocument(doc);
     }
 }
Exemple #11
0
        private Document StoreBlob(Database db, MutableDocument doc, byte[] content)
        {
            var blob = new Blob("text/plain", content);

            doc.SetBlob("data", blob);
            Db.Save(doc);
            return(Db.GetDocument(doc.Id));
        }
Exemple #12
0
 public override void InsertObject(uint index)
 {
     using (var doc = new MutableDocument()) {
         doc.Set("name", NameValue(index))
         .Set("age", AgeValue(index))
         .Set("is_hired", IsHiredValue(index));
         db?.Save(doc);
     }
 }
        public void TestPurgePreSaveDoc()
        {
            var doc = new MutableDocument("doc1");

            doc.SetInt("key", 1);

            Db.Purge(doc);
            Db.Count.Should().Be(0UL, "because the database should still be empty");
        }
Exemple #14
0
        //Products End

        //Orders

        public void AddOrderMaster(Database db)
        {
            String    straddstatus = String.Empty;
            Hashtable hstcustadd   = new Hashtable();

            Console.WriteLine();
            string[] arr1 = new string[] { "DOC_NBR", "CUST_NBR" };

            foreach (String strcol in arr1)
            {
                String mutestr   = String.Empty;
                bool   userentry = true;

                Console.Write("Please enter " + strcol + " : ");
                mutestr = Console.ReadLine();
                Console.WriteLine();

                while (userentry)
                {
                    if (!String.IsNullOrEmpty(mutestr))
                    {
                        hstcustadd.Add(strcol, mutestr);
                        break;
                    }
                    else
                    {
                        Console.WriteLine("Please enter " + strcol);
                        mutestr   = Console.ReadLine();
                        userentry = true;
                    }
                }
            }

            using (var CustomerDoc = new MutableDocument(hstcustadd["DOC_NBR"].ToString()))
            {
                CustomerDoc.SetString("DOC_NBR", hstcustadd["DOC_NBR"].ToString());
                CustomerDoc.SetString("CUST_NBR", hstcustadd["CUST_NBR"].ToString());
                CustomerDoc.SetString("ORDER_CREATED_DT", DateTime.Now.ToString("MM/dd/yyyy"));
                CustomerDoc.SetString("ITEM_ID", "06417601");
                CustomerDoc.SetString("ORD_QTY", "10");
                CustomerDoc.SetString("RETL_AMT", "100");
                //CustomerDoc.SetString("ORDER_DETAILS", "<DocNbr>" + hstcustadd["DOC_NBR"].ToString() + "</DocNbr><CustNbr>" + hstcustadd["CUST_NBR"].ToString() + "</CustNbr><ItemId>06417601</ItemId><OrdQty>1</OrdQty><RetlPriceAmt>0.99</RetlPriceAmt><TaxFlg>1</TaxFlg></SaleLineItemDtl>");

                db.Save(CustomerDoc);
                Console.WriteLine();
                Console.WriteLine("Order " + hstcustadd["DOC_NBR"].ToString() + " Created Succefully");
            }

            syncorder(db);

            Console.WriteLine();
            runselectOrders(db);
            Console.WriteLine();
            Promptuser(db, "Order");
        }
        public override InsertResult InsertOne(T entity, InsertMode insertMode)
        {
            CheckOpenedConnection();

            var createdDate = NoSQLRepoHelper.DateTimeUtcNow();
            var updateddate = NoSQLRepoHelper.DateTimeUtcNow();

            MutableDocument mutabledocument;

            if (!string.IsNullOrEmpty(entity.Id))
            {
                // Get an existing document or return a new one if not exists
                var document = database.GetDocument(entity.Id);
                if (document != null)
                {
                    // Document already exists
                    switch (insertMode)
                    {
                    case InsertMode.error_if_key_exists:
                        throw new DupplicateKeyNoSQLException();

                    case InsertMode.erase_existing:
                        createdDate = document.GetDate("SystemCreationDate");
                        database.Delete(document);
                        break;

                    case InsertMode.do_nothing_if_key_exists:
                        return(InsertResult.not_affected);

                    default:
                        break;
                    }
                }

                mutabledocument = new MutableDocument(entity.Id);
            }
            else
            {
                mutabledocument = new MutableDocument();
            }

            // Normally, at this point, the document is deleted from database or an exception occured.
            // We can insert the new document :
            mutabledocument.SetString("collection", CollectionName);

            entity.SystemCreationDate   = createdDate;
            entity.SystemLastUpdateDate = updateddate;
            entity.Id = mutabledocument.Id;

            SetDocument(entity, mutabledocument);

            database.Save(mutabledocument);

            return(InsertResult.inserted);
        }
        private Document GenerateDocument(string docID)
        {
            using (var doc = new MutableDocument(docID)) {
                doc.SetInt("key", 1);

                var saveDoc = Db.Save(doc);
                Db.Count.Should().Be(1UL, "because this is the first document");
                saveDoc.Sequence.Should().Be(1UL, "because this is the first document");
                return(saveDoc);
            }
        }
Exemple #17
0
        public void TestPurgePreSaveDoc()
        {
            var doc = new MutableDocument("doc1");

            doc.SetInt("key", 1);

            Db.Invoking(db => db.Purge(doc)).ShouldThrow <CouchbaseLiteException>()
            .Where(e => e.Error == CouchbaseLiteError.NotFound);

            Db.Count.Should().Be(0UL, "because the database should still be empty");
        }
Exemple #18
0
        //Cust End

        //Products

        public void AddProductMaster(Database db)
        {
            String    straddstatus = String.Empty;
            Hashtable hstcustadd   = new Hashtable();

            Console.WriteLine();
            string[] arr1 = new string[] { "ITEM_ID", "UPC", "SDV_AMT" };

            foreach (String strcol in arr1)
            {
                String mutestr   = String.Empty;
                bool   userentry = true;

                Console.Write("Please enter " + strcol + " : ");
                mutestr = Console.ReadLine();
                Console.WriteLine();

                while (userentry)
                {
                    if (!String.IsNullOrEmpty(mutestr))
                    {
                        hstcustadd.Add(strcol, mutestr);
                        break;
                    }
                    else
                    {
                        Console.WriteLine("Please enter " + strcol);
                        mutestr   = Console.ReadLine();
                        userentry = true;
                    }
                }
            }

            using (var CustomerDoc = new MutableDocument(hstcustadd["ITEM_ID"].ToString()))
            {
                CustomerDoc.SetString("ITEM_ID", hstcustadd["ITEM_ID"].ToString());
                CustomerDoc.SetString("PRD_EFF_DT", DateTime.Now.ToString("MM/dd/yyyy"));
                CustomerDoc.SetString("PRD_END_DT", "12/25/9999");
                CustomerDoc.SetString("UPC", hstcustadd["UPC"].ToString());
                CustomerDoc.SetString("ITEM_DESCP", "PRODUCT " + hstcustadd["UPC"].ToString());
                CustomerDoc.SetString("SDV_AMT", hstcustadd["SDV_AMT"].ToString());

                db.Save(CustomerDoc);
                Console.WriteLine();
                Console.WriteLine("Product " + hstcustadd["ITEM_ID"].ToString() + " Added Succefully");
            }

            syncprod(db);

            Console.WriteLine();
            runselectProduct(db);
            Console.WriteLine();
            Promptuser(db, "Product");
        }
        public void TestToSimpleObject()
        {
            var dictionary = new Dictionary <string, object>
            {
                ["StringValue"] = "Test Value"
            };

            var mutableDocument = new MutableDocument("test_id", dictionary);

            var simpleObject = mutableDocument.ToObject <TestObjects.SimpleObject>();
        }
        public void TestMultipleReplicatorsToListener()
        {
            _listener = Listen(CreateListenerConfig()); // writable listener

            // save a doc on listenerDB
            using (var doc = new MutableDocument()) {
                OtherDb.Save(doc);
            }

            ValidateMultipleReplicationsTo(ReplicatorType.PushAndPull);
        }
        public void AddItem(string name, String value)
        {
            using (var mutableDoc = new MutableDocument())
            {
                System.Diagnostics.Debug.WriteLine("ID from new doc " + mutableDoc.Id);
                mutableDoc.SetString("name", name).SetString("value", value).SetString("ID", mutableDoc.Id);

                // Save it to the database
                this.database.Save(mutableDoc);
            }
        }
Exemple #22
0
        private static void UseTypedAccessors()
        {
            using (var newTask = new MutableDocument()) {
                // # tag::date-getter[]
                newTask.SetValue("createdAt", DateTimeOffset.UtcNow);
                var date = newTask.GetDate("createdAt");
                // # end::date-getter[]

                Console.WriteLine(date);
            }
        }
Exemple #23
0
        private static void Read1xAttachment()
        {
            var db = _Database;

            using (var document = new MutableDocument()) {
                // # tag::1x-attachment[]
                var attachments = document.GetDictionary("_attachments");
                var avatar      = attachments.GetBlob("avatar");
                var content     = avatar?.Content;
                // # end::1x-attachment[]
            }
        }
        public void TestToSimpleObjectWithSimpleArray()
        {
            var dictionary = new Dictionary <string, object>
            {
                ["StringValue"] = "Test Value",
                ["ArrayValue"]  = new string[] { "Value1", "Value2" }
            };

            var mutableDocument = new MutableDocument("test_id", dictionary);

            var simpleObject = mutableDocument.ToObject <TestObjects.SimpleObject>();
        }
        public void TestSaveDocToDeletedDB()
        {
            DeleteDB(Db);
            var doc = new MutableDocument("doc1");

            doc.SetInt("key", 1);

            Db.Invoking(d => d.Save(doc))
            .ShouldThrow <InvalidOperationException>()
            .WithMessage("Attempt to perform an operation on a closed database",
                         "because this operation is invalid");
        }
Exemple #26
0
        //Cust

        public void AddCustomerMaster(Database db)
        {
            String    straddstatus = String.Empty;
            Hashtable hstcustadd   = new Hashtable();

            Console.WriteLine();
            string[] arr1 = new string[] { "CUST_NBR", "CUST_NM", "STORE_NBR" };

            foreach (String strcol in arr1)
            {
                String mutestr   = String.Empty;
                bool   userentry = true;

                Console.Write("Please enter " + strcol + " : ");
                mutestr = Console.ReadLine();
                Console.WriteLine();

                while (userentry)
                {
                    if (!String.IsNullOrEmpty(mutestr))
                    {
                        hstcustadd.Add(strcol, mutestr);
                        break;
                    }
                    else
                    {
                        Console.WriteLine("Please enter " + strcol);
                        mutestr   = Console.ReadLine();
                        userentry = true;
                    }
                }
            }

            using (var CustomerDoc = new MutableDocument(hstcustadd["CUST_NBR"].ToString()))
            {
                CustomerDoc.SetString("CUST_NBR", hstcustadd["CUST_NBR"].ToString());
                CustomerDoc.SetString("CUST_EFF_DT", DateTime.Now.ToString("MM/dd/yyyy"));
                CustomerDoc.SetString("CUST_END_DT", "12/25/9999");
                CustomerDoc.SetString("CUST_NM", hstcustadd["CUST_NM"].ToString());
                CustomerDoc.SetString("STORE_NBR", hstcustadd["STORE_NBR"].ToString());

                db.Save(CustomerDoc);
                Console.WriteLine();
                Console.WriteLine("Customer " + hstcustadd["CUST_NBR"].ToString() + " Added Succefully");

                synccust(db);
            }

            Console.WriteLine();
            runselect(db);
            Console.WriteLine();
            Promptuser(db, "Customer");
        }
        public void TestDeletePreSaveDoc()
        {
            var doc = new MutableDocument("doc1");

            doc.SetInt("key", 1);

            Db.Invoking(d => d.Delete(doc))
            .ShouldThrow <CouchbaseLiteException>()
            .Which.Status.Should()
            .Be(StatusCode.NotAllowed, "because deleting an unsaved document is not allowed");
            Db.Count.Should().Be(0UL, "because the database should still be empty");
        }
        private void WithActiveReplicatorAndURLEndpointListeners(bool isCloseNotDelete)
        {
            WaitAssert waitIdleAssert1    = new WaitAssert();
            WaitAssert waitStoppedAssert1 = new WaitAssert();

            _listener = CreateListener();
            var _listener2 = CreateNewListener();

            _listener.Config.Database.ActiveStoppables.Count.Should().Be(2);
            _listener2.Config.Database.ActiveStoppables.Count.Should().Be(2);

            using (var doc1 = new MutableDocument("doc1"))
                using (var doc2 = new MutableDocument("doc2")) {
                    doc1.SetString("name", "Sam");
                    Db.Save(doc1);
                    doc2.SetString("name", "Mary");
                    OtherDb.Save(doc2);
                }

            var target  = new DatabaseEndpoint(Db);
            var config1 = CreateConfig(target, ReplicatorType.PushAndPull, true, sourceDb: OtherDb);
            var repl1   = new Replicator(config1);

            repl1.AddChangeListener((sender, args) => {
                waitIdleAssert1.RunConditionalAssert(() => {
                    return(args.Status.Activity == ReplicatorActivityLevel.Idle);
                });

                waitStoppedAssert1.RunConditionalAssert(() => {
                    return(args.Status.Activity == ReplicatorActivityLevel.Stopped);
                });
            });

            repl1.Start();

            waitIdleAssert1.WaitForResult(TimeSpan.FromSeconds(10));
            OtherDb.ActiveStoppables.Count.Should().Be(3);

            if (isCloseNotDelete)
            {
                OtherDb.Close();
            }
            else
            {
                OtherDb.Delete();
            }

            OtherDb.ActiveStoppables.Count.Should().Be(0);
            OtherDb.IsClosedLocked.Should().Be(true);

            waitStoppedAssert1.WaitForResult(TimeSpan.FromSeconds(30));
        }
        public void TestDictionaryArray()
        {
            var doc  = new MutableDocument("doc1");
            var data = new[] {
                new Dictionary <string, object> {
                    ["name"] = "1"
                },
                new Dictionary <string, object> {
                    ["name"] = "2"
                },
                new Dictionary <string, object> {
                    ["name"] = "3"
                },
                new Dictionary <string, object> {
                    ["name"] = "4"
                }
            };

            doc.SetData(new Dictionary <string, object> {
                ["dicts"] = data
            });

            var dicts = doc.GetArray("dicts");

            dicts.Count.Should().Be(4, "because that is the number of entries added");

            var d1 = dicts.GetDictionary(0);
            var d2 = dicts.GetDictionary(1);
            var d3 = dicts.GetDictionary(2);
            var d4 = dicts.GetDictionary(3);

            d1.GetString("name").Should().Be("1", "because that is what was stored");
            d2.GetString("name").Should().Be("2", "because that is what was stored");
            d3.GetString("name").Should().Be("3", "because that is what was stored");
            d4.GetString("name").Should().Be("4", "because that is what was stored");

            Db.Save(doc);
            var gotDoc     = Db.GetDocument("doc1");
            var savedDicts = gotDoc.GetArray("dicts");

            savedDicts.Count.Should().Be(4, "because that is the number of entries");

            var savedD1 = savedDicts.GetDictionary(0);
            var savedD2 = savedDicts.GetDictionary(1);
            var savedD3 = savedDicts.GetDictionary(2);
            var savedD4 = savedDicts.GetDictionary(3);

            savedD1.GetString("name").Should().Be("1", "because that is what was stored");
            savedD2.GetString("name").Should().Be("2", "because that is what was stored");
            savedD3.GetString("name").Should().Be("3", "because that is what was stored");
            savedD4.GetString("name").Should().Be("4", "because that is what was stored");
        }
Exemple #30
0
        public void TestDictionaryWithULong()
        {
            using (var doc = new MutableDocument("test_ulong")) {
                var dict = new MutableDictionaryObject();
                dict.SetValue("high_value", UInt64.MaxValue);
                doc.SetDictionary("nested", dict);
                Db.Save(doc);
            }

            using (var doc = Db.GetDocument("test_ulong")) {
                doc["nested"]["high_value"].Value.Should().Be(UInt64.MaxValue);
            }
        }