public void TestOriginalValue()
        {
            Helper.DropAllCollections();

            var c = new Country {Code = "ES", Name = "España"};
            c.Save();

            var p = new Person
                {
                    Name = "Pepito Perez",
                    Age = 35,
                    BirthDate = DateTime.Now.AddDays(57).AddYears(-35),
                    Married = true,
                    Country = "ES",
                    BankBalance = decimal.Parse("3500,00")
                };

            p.Childs.Add(
                new Child {ID = 1, Age = 10, BirthDate = DateTime.Now.AddDays(57).AddYears(-10), Name = "Juan Perez"});
            p.Childs.Add(
                new Child {ID = 2, Age = 7, BirthDate = DateTime.Now.AddDays(57).AddYears(-7), Name = "Ana Perez"});
            p.Save();

            p.Name = "Juan Sin Miedo";

            object originalName = p.GetOriginalObject().Name;

            Assert.AreEqual(originalName.ToString(), "Pepito Perez");
        }
        public void TestOriginalObjectCustom()
        {
            (new InsertModifyDeleteTest()).TestInsert();
            Person p = MongoMapperCollection <Person> .Instance.Find().FirstAsync().Result;

            p.Name = "hola 25";

            var p2 = p.GetOriginalObject();

            Assert.AreEqual("Pepito Perez", p2.Name);
            p.Save();

            p.Name = "Andres";
            p.SaveOriginal(true);
            p.Name = "Pepe";

            p2 = p.GetOriginalObject();
            Assert.AreEqual("Andres", p2.Name);
        }
        public void TestOriginalValue()
        {
            Helper.DropAllCollections();

            var c = new Country {
                Code = "ES", Name = "España"
            };

            c.Save();

            var p = new Person
            {
                Name        = "Pepito Perez",
                Age         = 35,
                BirthDate   = DateTime.Now.AddDays(57).AddYears(-35),
                Married     = true,
                Country     = "ES",
                BankBalance = decimal.Parse("3500,00")
            };

            p.Childs.Add(
                new Child {
                ID = 1, Age = 10, BirthDate = DateTime.Now.AddDays(57).AddYears(-10), Name = "Juan Perez"
            });
            p.Childs.Add(
                new Child {
                ID = 2, Age = 7, BirthDate = DateTime.Now.AddDays(57).AddYears(-7), Name = "Ana Perez"
            });
            p.Save();

            p.Name = "Juan Sin Miedo";

            object originalName = p.GetOriginalObject().Name;

            Assert.AreEqual(originalName.ToString(), "Pepito Perez");
        }