public void DoNotAddSameInstanceToObjectPool() { ObjectPool.pool.Clear(); ConstructorControlPanel control = new ConstructorControlPanel(); ConstructorInfo info = typeof(TestClass).GetConstructor(new Type[] { }); control.Initialize(info); string instance = "something"; control.Lastresult = instance; control.OnAddToPool(null, null); control.OnAddToPool(null, null); control.OnAddToPool(null, null); control.OnAddToPool(null, null); Assert.AreEqual(1, ObjectPool.pool.Count); }
public void PlusButtonAddsInstanceToObjectPool() { ObjectPool.pool.Clear(); ConstructorControlPanel control = new ConstructorControlPanel(); ConstructorInfo info = typeof(TestClass).GetConstructor(new Type[] { }); control.Initialize(info); string instance = "something"; control.Lastresult = instance; control.OnAddToPool(null, null); Assert.IsTrue(ObjectPool.pool.Contains(instance)); }
public void AddingInstanceToObjectPoolLogsMessage() { ObjectPool.pool.Clear(); ConstructorControlPanel control = new ConstructorControlPanel(); ConstructorInfo info = typeof(TestClass).GetConstructor(new Type[] { }); control.Initialize(info); control.comboBoxMessageBar.Items.Add("other stuff 1"); control.comboBoxMessageBar.Items.Add("other stuff 2"); string instance = "something"; control.Lastresult = instance; control.OnAddToPool(null, null); Assert.AreEqual("String added to Object pool.", (string)control.comboBoxMessageBar.Items[0]); }