Пример #1
0
        /// <summary>
        /// Compare lists of Thing entities
        /// </summary>
        /// <param name="expected"></param>
        /// <param name="actual"></param>
        public static void Compare(ThingList expected, ThingList actual)
        {
            // Check for nulls
            if (expected == null && actual == null)
            {
                return;
            }
            if (expected == null)
            {
                Assert.Fail("Expected null, got list");
            }
            if (actual == null)
            {
                Assert.Fail("Expected list, got null");
            }

            // Check counts
            Assert.AreEqual(expected.Count, actual.Count, "List counts not equal");

            // Now compare each entity in the list
            expected.SortById();
            actual.SortById();
            for (int index = 0; index < expected.Count; index++)
            {
                Compare(expected[index], actual[index]);
            }
        }
Пример #2
0
        /// <summary>
        ///	Returns a copy of the instance of Thing
        /// </summary>
        /// <remarks>
        /// Overrides the base version, but calls OnClone to allow base classes chance
        /// to clone their information
        /// </remarks>
        public override object Clone()
        {
            // Create a new list.
            ThingList clone = new ThingList();

            // Let the base class clone all of the items in our collection.
            OnClone(clone);
            // N.B. OnClone can be overridden in the handmade part of this
            // partial class to add extra code during clone (but make sure
            // you call the base version to copy the collection)

            // Return our pristine clone!
            return(clone);
        }