public void AddTestAttribute(TestAttribute ta)
		{
			testList.Add(ta);
		}
		private static string GetTestName(TestAttribute ta)
		{
			return ta.TestClass.FullName + ":" + ta.TestMethod.ToString();
		}
        private void RunTest(TestNotificationDelegate testNotificationEvent, object instance, TestAttribute ta)
        {
            if (!ta.IgnoreTest())
            {
                try
                {
                    if (sua != null) 
							sua.Invoke(instance);
                    ta.Invoke(instance);
                    // If we get here, the test did not throw an exception.
                    // Was it supposed too?
                    if (ta.ExpectedExceptionType != null)
                    {
                        Trace.WriteLine("***Fail***: " + ta.TestMethod.ToString() + " Expected exception not encountered");
                        ta.State = TestAttribute.TestState.Fail;
                    }
                    else
                    {
                        Trace.WriteLine("***Pass***: " + ta.TestMethod.ToString());
                        ta.State = TestAttribute.TestState.Pass;
                    }
                }

                catch (AssertFailedException e)
                {
                    Trace.WriteLine("***Fail***: " + ta.TestMethod.ToString() + " Exception=" + e.Message);
                    ta.State = TestAttribute.TestState.Fail;
                }

                catch (Exception e)
                {
                    if (e.GetType() != ta.ExpectedExceptionType)
                    {
                        Trace.WriteLine("***Fail***: " + ta.TestMethod.ToString() + " Exception=" + e.Message);
                        ta.State = TestAttribute.TestState.Fail;
                    }
                    else
                    {
                        Trace.WriteLine("***Pass***: " + ta.TestMethod.ToString() + " Exception=" + e.Message);
                        ta.State = TestAttribute.TestState.Pass;
                    }
                }
                finally
                {
                    if (tda != null) tda.Invoke(instance);
                }
            }
            else
            {
                //Trace.WriteLine("***Ignore***: " + ta.TestMethod.ToString());
                ta.State = TestAttribute.TestState.Ignore;
            }
            if (testNotificationEvent != null)
            {
                testNotificationEvent(ta);
            }
        }
		public void ParseAssemblies()
		{
			numTests=0;

			foreach (AssemblyItem ai in assemblyCollection.Values)
			{
				foreach (NamespaceItem ni in ai.NamespaceCollection.Values)
				{
					foreach (ClassItem ci in ni.ClassCollection.Values)
					{
						TestFixture tf=new TestFixture();
						foreach (Attribute attr in ci.Attributes)
						{
                            
							// verify that attribute class is "UnitTest"
							string attrStr=attr.ToString();
							attrStr=StringHelpers.RightOfRightmostOf(attrStr, '.');
							Trace.WriteLine("Class: "+ci.ToString()+", Attribute: "+attrStr);
                            
							try
							{
                                if (attr.GetType() == typeof(TestClassAttribute))
                                {
                                    TestUnitAttribute tua = new TestFixtureAttribute();
                                    tua.Initialize(ci, null, attr);
                                    tua.SelfRegister(tf);
                                }
							}
							catch(Exception e)
							{
								Trace.WriteLine("Exception adding attribute: "+e.Message);
								Trace.WriteLine("Attribute "+attrStr+" is unknown");
							}
						}

						if (tf.HasTestFixture)
						{
							foreach(MethodItem mi in ci.MethodCollection.Values)
							{
								foreach (object attr in mi.Attributes)
								{
									// verify that attribute class is "UnitTest"
									string attrStr=attr.ToString();
									attrStr=StringHelpers.RightOfRightmostOf(attrStr, '.');
									Trace.WriteLine("Method: "+mi.ToString()+", Attribute: "+attrStr);
									try
									{
                                        if (attr.GetType() == typeof(TestMethodAttribute))
                                        {
                                            TestUnitAttribute tua = new TestAttribute();
                                            tua.Initialize(ci, mi, attr);
                                            tua.SelfRegister(tf);
                                        }
                                        else if (attr.GetType() == typeof(PexRaisedExceptionAttribute))
                                        {
                                            PexRaisedExceptionAttribute excAttr = (PexRaisedExceptionAttribute)attr;

                                            TestUnitAttribute tua = new ExpectedExceptionAttribute();
                                            tua.Initialize(ci, mi, attr);
                                            tua.SelfRegister(tf);
                                        }
									}
									catch(TypeLoadException)
									{
										Trace.WriteLine("Attribute "+attrStr+"is unknown");
									}
								}
							}
							testFixtureList.Add(tf);
							numTests+=tf.NumTests;
						}
					}
				}
			}
		}