public void GetObjectReallyDoesPopulateANewIListInstanceWithTheElementsOfTheSourceList()
        {
            // man, that has got to be my second longest ever test name :D ...
            IList source = new TestObject[]
            {
                new TestObject("Rick", 30),
                new TestObject("Mark", 35),
                new TestObject("Griffin", 21),
            };

            ListFactoryObject lfo = new ListFactoryObject();

            lfo.SourceList = source;
            lfo.AfterPropertiesSet();

            IList list = (IList)lfo.GetObject();

            Assert.IsNotNull(list);
            Assert.AreEqual(source.Count, list.Count);
            for (int i = 0; i < list.Count; ++i)
            {
                TestObject dude         = (TestObject)list[i];
                TestObject originalDude = (TestObject)source[i];
                Assert.IsTrue(object.ReferenceEquals(dude, originalDude));
            }
        }
        public void GetObjectWithoutSupplyingASourceList()
        {
            ListFactoryObject lfo = new ListFactoryObject();

            lfo.IsSingleton = false;
            Assert.Throws <ArgumentException>(() => lfo.GetObject(), "The 'SourceList' property cannot be null (Nothing in Visual Basic.NET).");
        }
        public void SetTargetListTypeToNull()
        {
            ListFactoryObject lfo = new ListFactoryObject();

            Assert.Throws <ArgumentNullException>(() => lfo.TargetListType = null);
        }
        public void SetTargetListTypeToAbstractIListInterfaceType()
        {
            ListFactoryObject lfo = new ListFactoryObject();

            Assert.Throws <ArgumentException>(() => lfo.TargetListType = typeof(AbstractList), "The Type passed to the TargetListType property cannot be abstract (MustInherit in VisualBasic.NET); it must be a concrete class that implements the 'System.Collections.IList' interface.");
        }
        public void SetTargetListTypeToDerivedIListInterfaceType()
        {
            ListFactoryObject lfo = new ListFactoryObject();

            Assert.Throws <ArgumentException>(() => lfo.TargetListType = typeof(IExtendedList), "The Type passed to the TargetListType property cannot be an interface; it must be a concrete class that implements the 'System.Collections.IList' interface.");
        }
        public void SetTargetListTypeToNonListType()
        {
            ListFactoryObject lfo = new ListFactoryObject();

            Assert.Throws <ArgumentException>(() => lfo.TargetListType = typeof(ICollection), "The Type passed to the TargetListType property must implement the 'System.Collections.IList' interface.");
        }