protected bool SameObject(UserLoginhistory lhs, UserLoginhistory rhs) { if (lhs.HistoryId != rhs.HistoryId) { return(false); } if (lhs.UserDatas.Count != rhs.UserDatas.Count) { return(false); } for (int i = 0; i < lhs.UserDatas.Count; i++) { if (lhs.UserDatas[i].UserId != rhs.UserDatas[i].UserId) { return(false); } if (lhs.UserDatas[i].GreetingsMessage != rhs.UserDatas[i].GreetingsMessage) { return(false); } if (lhs.UserDatas[i].LastLoggedIn != rhs.UserDatas[i].LastLoggedIn) { return(false); } } if (lhs.Created != rhs.Created) { return(false); } return(true); }
public void TestSerializeNestedClassInstance() { var history = new UserLoginhistory { HistoryId = 1324, UserDatas = GenerateDummyElements(), Created = DateTime.UtcNow }; var bytes = MessagePackSerializer.Serialize(history); var result = MessagePackSerializer.Deserialize <UserLoginhistory>(bytes); Assert.AreEqual(SameObject(history, result), true); }