public void TestSerializeRole() { System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); SCRole obj1 = SCObjectGenerator.PrepareRoleObject(); obj1.CreateDate = DateTime.Now; obj1.VersionEndTime = new DateTime(567890); obj1.VersionEndTime = DateTime.MaxValue; System.IO.MemoryStream ms = new System.IO.MemoryStream(); bf.Serialize(ms, obj1); ms.Seek(0, System.IO.SeekOrigin.Begin); SCRole obj2 = (SCRole)bf.Deserialize(ms); CommonAssert(obj1, obj2); }
public void TestSerializeMemberRelation() { System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); var role = SCObjectGenerator.PrepareRoleObject(); var user = SCObjectGenerator.PrepareUserObject(); var obj1 = new SCMemberRelation(role, user); obj1.CreateDate = DateTime.Now; obj1.VersionEndTime = new DateTime(567890); obj1.VersionEndTime = DateTime.MaxValue; obj1.ID = MCS.Library.Core.UuidHelper.NewUuidString(); obj1.InnerSort = 23; obj1.Status = SchemaObjectStatus.Deleted; System.IO.MemoryStream ms = new System.IO.MemoryStream(); bf.Serialize(ms, obj1); ms.Seek(0, System.IO.SeekOrigin.Begin); var obj2 = (SCMemberRelation)bf.Deserialize(ms); RelationAssert(obj1, obj2); }