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 GetObjectWithoutSupplyingASourceList() { ListFactoryObject lfo = new ListFactoryObject(); lfo.IsSingleton = false; lfo.GetObject(); }
public void CollectionFactoryDefaults() { ListFactoryObject listFactory = new ListFactoryObject(); listFactory.SourceList = new ArrayList(); listFactory.AfterPropertiesSet(); Assert.IsTrue(listFactory.GetObject() is ArrayList); SetFactoryObject setFactory = new SetFactoryObject(); setFactory.SourceSet = new HybridSet(); setFactory.AfterPropertiesSet(); Assert.IsTrue(setFactory.GetObject() is HybridSet); DictionaryFactoryObject dictionaryFactory = new DictionaryFactoryObject(); dictionaryFactory.SourceDictionary = new Hashtable(); dictionaryFactory.AfterPropertiesSet(); Assert.IsTrue(dictionaryFactory.GetObject() is Hashtable); }
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; lfo.GetObject(); }
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)."); }