Update of /cvsroot/adapdev/Adapdev/src/Adapdev.Tests
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7036/src/Adapdev.Tests
Modified Files:
ObjectComparerTest.cs
Log Message:
Improved ObjectComparer to include field comparisons
Added AssociationType for ForeignKeyAssociations
Improved CacheManager and associated tests
Index: ObjectComparerTest.cs
===================================================================
RCS file: /cvsroot/adapdev/Adapdev/src/Adapdev.Tests/ObjectComparerTest.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ObjectComparerTest.cs 3 Jun 2005 04:32:59 -0000 1.1
--- ObjectComparerTest.cs 2 Nov 2005 13:45:13 -0000 1.2
***************
*** 1,4 ****
--- 1,7 ----
using System;
+ using System.Text;
+ using System.Threading;
using Adapdev.Mock;
+ using Adapdev.Serialization;
using NUnit.Framework;
***************
*** 34,37 ****
--- 37,92 ----
}
+
+ [Test]
+ public void FailAreEqualWithFields()
+ {
+ DateTime now = DateTime.Now;
+
+ SuppliersEntity e1 = new SuppliersEntity();
+ e1.Address = "Test";
+ e1.SupplierID = 12;
+ e1.Created = now;
+
+ Thread.Sleep(1000);
+
+ SuppliersEntity e2 = new SuppliersEntity();
+ e2.Address = "Test";
+ e2.SupplierID = 12;
+ e2.Created = now;
+
+ //Console.WriteLine(e1);
+ //Console.WriteLine(e2);
+
+ Assert.IsFalse(ObjectComparer.AreEqual(e1, e2, true), "Objects should not be equal because InternalCreated is different.");
+ }
+
+ [Test]
+ public void FailAreEqualWithFieldsSerialization()
+ {
+ DateTime now = DateTime.Now;
+
+ SuppliersEntity e1 = new SuppliersEntity();
+ e1.Address = "Test";
+ e1.SupplierID = 12;
+ e1.Created = now;
+
+ SuppliersEntity e2 = new SuppliersEntity();
+ e2.Address = "Test";
+ e2.SupplierID = 12;
+ e2.Created = now;
+
+ string a = Serializer.SerializeToXml(e1);
+ string b = Serializer.SerializeToXml(e2);
+
+ Console.WriteLine(a);
+ Console.WriteLine(b);
+ Assert.IsTrue(a == b, "Objects should be equal.");
+
+ e2.Created = DateTime.Now.AddHours(1);
+
+ // byte[] c = Serializer.SerializeToBinary(e2);
+ //
+ // Assert.IsFalse(a == c, "Objects should not be equal.");
+ }
}
}
|