public void getInfo() { StudentWin obj = new StudentWin(); Panel obj2 = null; List <Control> list = new List <Control>(); GlobalItems.GetAllControl(obj, list); foreach (Control control in list) { if (control.GetType() == typeof(Panel) && control.Name == "myInfoPanel") { obj2 = new Panel(); } } Assert.IsNotNull(obj2); }