public void TestRemoveDictionary()
        {
            var doc      = new MutableDocument("doc1");
            var profile1 = new MutableDictionaryObject();

            profile1.SetString("name", "Scott Tiger");
            doc.SetDictionary("profile", profile1);
            doc.GetDictionary("profile").ShouldBeEquivalentTo(profile1, "because that was what was inserted");
            doc.Contains("profile").Should().BeTrue("because a value exists for that key");

            doc.Remove("profile");
            doc.GetValue("profile").Should().BeNull("beacuse the value for 'profile' was removed");
            doc.Contains("profile").Should().BeFalse("because the value was removed");

            profile1.SetInt("age", 20);
            profile1.GetString("name").Should().Be("Scott Tiger", "because the dictionary object should be unaffected");
            profile1.GetInt("age").Should().Be(20, "because the dictionary should still be editable");

            doc.GetValue("profile").Should()
            .BeNull("because changes to the dictionary should not have any affect anymore");

            var savedDoc = Db.Save(doc);

            savedDoc.GetValue("profile").Should().BeNull("beacuse the value for 'profile' was removed");
            savedDoc.Contains("profile").Should().BeFalse("because the value was removed");
        }
        public void JsonApiDocument()
        {
            // tag::tojson-document[]
            Database this_DB = new Database("travel-sample");
            Database newDb   = new Database("ournewdb");

            // Get a document
            var thisDoc = this_Db.GetDocument("hotel_10025");

            // Get document data as JSON String
            var thisDocAsJsonString = thisDoc?.ToJSON(); // <.>

            // Get Json Object from the Json String
            JObject myJsonObj = JObject.Parse(thisDocAsJsonString);

            // Get Native Object (anhotel) from JSON String
            List <Hotel> thehotels = new List <Hotel>();

            Hotel anhotel = new Hotel();

            anhotel = JsonConvert.DeserializeObject <Hotel>(thisDocAsJsonString);
            thehotels.Add(anhotel);

            // Update the retrieved native object
            anhotel.Name = "A Copy of " + anhotel.Name;
            anhotel.Id   = "2001";

            // Convert the updated object back to a JSON string
            var newJsonString = JsonConvert.SerializeObject(anhotel);

            // Update new document with JSOn String
            MutableDocument newhotel =
                new MutableDocument(anhotel.Id, newJsonString); // <.>

            foreach (string key in newhotel.ToDictionary().Keys)
            {
                System.Console.WriteLine("Data -- {0} = {1}",
                                         key, newhotel.GetValue(key));
            }

            newDb.Save(newhotel);

            var thatDoc = newDb.GetDocument("2001").ToJSON(); // <.>

            System.Console.Write(thatDoc);

            // end::tojson-document[]


            //    // tag::tojson-document-output[]
            //    JSON String = { "description":"Very good and central","id":"1000","country":"France","name":"Hotel Ted","type":"hotel","city":"Paris"}
            //             type = hotel
            //             id = 1000
            //             country = France
            //             city = Paris
            //             description = Very good and central
            //             name = Hotel Ted
            //        // end::tojson-document-output[]
            //         */
        } // End JSONAPIDocument