2 using System.Reflection;
7 /// Represents a test suite constructed from a type that has a static Suite property
9 public class LegacySuite : TestSuite
11 private PropertyInfo suiteProperty;
15 public LegacySuite( Type fixtureType ) : base( fixtureType, 0 )
20 public LegacySuite( Type fixtureType, int assemblyKey ) : base( fixtureType, assemblyKey )
25 public LegacySuite( object fixture ) : base( fixture, 0 )
30 public LegacySuite( object fixture, int assemblyKey ) : base( fixture, assemblyKey )
35 private void Initialize()
37 suiteProperty = Reflect.GetSuiteProperty( this.fixtureType );
39 MethodInfo method = suiteProperty.GetGetMethod(true);
40 if(method.ReturnType!=typeof(NUnit.Core.TestSuite) || method.GetParameters().Length>0)
42 this.ShouldRun = false;
43 this.IgnoreReason = "Invalid suite property method signature";
47 TestSuite suite = (TestSuite)suiteProperty.GetValue(null, new Object[0]);
48 foreach( Test test in suite.Tests )
55 #region Static methods
57 public static bool IsValidType( Type type )
59 return Reflect.GetSuiteProperty( type ) != null;