Пример #1
0
        public void CanPopulateChanges()
        {
            string xmlWithChanges = _first.CompareChanges(_second);
            //convert xmlWithChanges into object
            AuditTrail auditTrail = xmlWithChanges.DeserializeFromString <AuditTrail>();

            Assert.AreEqual("Tests.TestClass", auditTrail.EntityName);
            Assert.AreEqual(5, auditTrail.ChangedProperties.Count);
            Assert.AreEqual(4.34, auditTrail.ChangedProperties.First(t => t.Name == "RealValue").OldValue);
            Assert.AreEqual(13, auditTrail.ChangedProperties.First(t => t.Name == "Id").OldValue);
            Assert.AreEqual(3933, auditTrail.ChangedProperties.First(t => t.Name == "LongValue").OldValue);
            Assert.AreEqual("this is first", auditTrail.ChangedProperties.First(t => t.Name == "TextField").OldValue);

            Assert.AreEqual(7.484, auditTrail.ChangedProperties.First(t => t.Name == "RealValue").NewValue);
            Assert.AreEqual(123, auditTrail.ChangedProperties.First(t => t.Name == "Id").NewValue);
            Assert.AreEqual(393322, auditTrail.ChangedProperties.First(t => t.Name == "LongValue").NewValue);
            Assert.AreEqual("this is second", auditTrail.ChangedProperties.First(t => t.Name == "TextField").NewValue);

            //trying to access property
            Assert.AreEqual(7.484, auditTrail.GetProperty <double>("RealValue"));
        }