public void Verify_customer_name_can_be_restored()
        {
            var customer = new Customer()
                               {
                                   Id = 8569,
                                   Name = "Mahela Jayawardene"
                               };

            MeasureTime("[customer = PocoStateMonitorUtility.Current.BeginMonitoring(customer)]", () =>
                            {
                                customer = PocoStateMonitorUtility.Current.BeginMonitoring(customer);
                            });

            MeasureTime("[var id = customer.Id]", () => { var id = customer.Id; });

            MeasureTime("[Assert.AreEqual(8569, customer.Id)]", () => Assert.AreEqual(8569, customer.Id));

            MeasureTime("[Assert.AreEqual('Mahela Jayawardene', customer.Name)]", () => Assert.AreEqual("Mahela Jayawardene", customer.Name));

            MeasureTime("[customer.Name = 'Jayawardene, Mahela']", () => { customer.Name = "Jayawardene, Mahela";});

            MeasureTime("[Assert.AreEqual('Jayawardene, Mahela', customer.Name)]", () => Assert.AreEqual("Jayawardene, Mahela", customer.Name));

            MeasureTime("[PocoStateMonitorUtility.Current.Undo(customer)]", () => PocoStateMonitorUtility.Current.Undo(customer));

            MeasureTime("[customer.Id = 1253]", () => customer.Id = 1253);

            MeasureTime("[Assert.AreEqual(1253, customer.Id)]", () => Assert.AreEqual(1253, customer.Id));

            MeasureTime("[PocoStateMonitorUtility.Current.Undo(customer)]", () => PocoStateMonitorUtility.Current.Undo(customer));

            MeasureTime("[Assert.AreEqual(8569, customer.Id)]", () => Assert.AreEqual(8569, customer.Id));

            MeasureTime("[Assert.AreEqual('Mahela Jayawardene', customer.Name)]", () => Assert.AreEqual("Mahela Jayawardene", customer.Name));
        }
        public void Verify_a_second_level_undo_works()
        {
            var customer = new Customer()
                               {
                                   Id = 8569,
                                   Name = "Mahela Jayawardene"
                               };

            var jam = new Product()
                              {
                                  Name = "Jam",
                                  Price = 121.50
                              };

            var cheese = new Product()
                             {
                                 Name = "Cheese",
                                 Price = 121.50
                             };

            var order = new Order()
                            {
                                Customer = customer,
                                OrderDate = DateTime.UtcNow,
                                IsPaid = true,
                                Lines = new List<OrderLine>()
                                            {
                                                new OrderLine()
                                                    {
                                                        Product = jam,
                                                        Quantity = 3
                                                    },
                                                new OrderLine()
                                                    {
                                                        Product = cheese,
                                                        Quantity = 2
                                                    }
                                            }
                            };

            Assert.AreEqual("Mahela Jayawardene", order.Customer.Name);

            order = PocoStateMonitorUtility.Current.BeginMonitoring(order);

            order.Customer.Name = "Jayawardene, Mahela";
            Assert.AreEqual("Jayawardene, Mahela", order.Customer.Name);

            PocoStateMonitorUtility.Current.Undo(order);
            Assert.AreEqual("Mahela Jayawardene", order.Customer.Name);
        }