public void Can_Deep_Clone() { IUserGroup item = Build(); var clone = (IUserGroup)item.DeepClone(); var x = clone.Equals(item); Assert.AreNotSame(clone, item); Assert.AreEqual(clone, item); Assert.AreEqual(clone.AllowedSections.Count(), item.AllowedSections.Count()); Assert.AreNotSame(clone.AllowedSections, item.AllowedSections); // Verify normal properties with reflection PropertyInfo[] allProps = clone.GetType().GetProperties(); foreach (PropertyInfo propertyInfo in allProps) { Assert.AreEqual(propertyInfo.GetValue(clone, null), propertyInfo.GetValue(item, null)); } }