public void AddFixtureRange(FixtureCollection fixtures) { if (fixtures == null) throw new ArgumentNullException("fixtures"); foreach (Fixture fixture in fixtures) AddFixture(fixture); }
public void Create(Type t, FixtureCollection fixtures) { MethodInfo mi = this.GetMain(t,new Type[] { typeof(string[]) }); if (mi == null) mi = this.GetMain(t,Type.EmptyTypes); if (mi == null) return; // create run SSCLIRun run = new SSCLIRun(mi, this.successReturnCode); Fixture fixture = new Fixture(t,run,null,null, false); fixtures.Add(fixture); }
public void Create(Type t, FixtureCollection fixtures) { // get framework IFramework framework = FrameworkFactory.FromType(t); if (framework == null) return; // get test attribute Object fixtureAttribute = TypeHelper.TryGetFirstCustomAttribute(t,framework.TestFixtureAttributeType); if (fixtureAttribute==null) return; // create run bool ignored = TypeHelper.HasCustomAttribute(t, framework.IgnoreAttributeType); MethodInfo setUp = TypeHelper.GetAttributedMethod(t, framework.TestFixtureSetUpAttributeType); MethodInfo tearDown = TypeHelper.GetAttributedMethod(t, framework.TestFixtureTearDownAttributeType); Fixture fixture = new Fixture(t, this.CreateRun(framework),setUp,tearDown, ignored); fixtures.Add(fixture); }
public void Create(Type t, FixtureCollection fixtures) { MethodInfo setUp = null; MethodInfo tearDown = null; bool setUpSearched = false; bool tearDownSearched=false; bool ignored = TypeHelper.HasCustomAttribute(t, typeof(IgnoreAttribute)); foreach (TestFixturePatternAttribute attr in t.GetCustomAttributes(typeof(TestFixturePatternAttribute), true)) { IRun run = null; try { run = attr.GetRun(); } catch (Exception ex) { run = new FixtureFailedLoadingRun(t, ex); } if (!setUpSearched) { setUp = TypeHelper.GetAttributedMethod(t, typeof(TestFixtureSetUpAttribute)); setUpSearched = true; } if (!tearDownSearched) { tearDown = TypeHelper.GetAttributedMethod(t, typeof(TestFixtureTearDownAttribute)); tearDownSearched = true; } Fixture fixture = new Fixture(t, run, setUp, tearDown, ignored); fixture.TimeOut = attr.GetTimeOut(); fixture.ApartmentState = attr.ApartmentState; fixtures.Add(fixture); } }
public void Create(Type t, FixtureCollection fixtures) { if (!t.IsClass) return; if (t.IsAbstract) return; if (!t.Name.EndsWith(this.fixtureNameSuffix)) return; MethodInfo setup = t.GetMethod(this.testFixtureSetUpName, Type.EmptyTypes); MethodInfo tearDown = t.GetMethod(this.testFixtureTearDownName, Type.EmptyTypes); Fixture fixture = new Fixture(t, this.run, setup, tearDown, false); fixtures.Add(fixture); }
protected void ExploreType(Type type) { // it is a class // it is not an interface // it is not abstract if (!type.IsClass || type.IsInterface || type.IsAbstract) return; // check if filter ok if (!this.Filter.Filter(type)) return; // look if any of the fixture attribute can return a run FixtureCollection fixs = new FixtureCollection(); foreach (IFixtureFactory factory in this.FixtureFactories) { fixs.Clear(); factory.Create(type, fixs); if (fixs.Count != 0) { this.fixtureGraph.AddFixtureRange(fixs); break; } } }
public Enumerator(FixtureCollection collection) { this.wrapped = ((System.Collections.CollectionBase)collection).GetEnumerator(); }