public override void Populate( GuidTestTreeNodeDictionary nodes, TestTreeNode rootNode, RunPipeStarterCollection pipes ) { if (rootNode == null) { throw new ArgumentNullException("rootNode"); } if (pipes == null) { throw new ArgumentNullException("pipes"); } if (this.parentNode == null) { this.parentNode = new TestTreeNode("Importances", TestNodeType.Populator); rootNode.Nodes.Add(this.parentNode); nodes.Add(this.parentNode); // adding nodes foreach (TestImportance ti in Enum.GetValues(typeof(TestImportance))) { this.addImportance(nodes, ti); } // add unknown Importance anonymous = this.addImportance(nodes, TestImportance.Default); } foreach (RunPipeStarter pipeStarter in pipes) { // get Importance attribute TestTreeNode node = null; if (TypeHelper.HasCustomAttribute(pipeStarter.Pipe.FixtureType, typeof(ImportanceAttribute))) { ImportanceAttribute Importance = (ImportanceAttribute)TypeHelper.GetFirstCustomAttribute( pipeStarter.Pipe.FixtureType, typeof(ImportanceAttribute)); node = addImportance(nodes, Importance.Importance); } else { node = anonymous; } TestTreeNode fixtureNode = addFixtureNode(nodes, node, pipeStarter); CreatePipeNode(nodes, fixtureNode, pipeStarter); } }
public override bool Filter(Type fixture) { if (fixture == null) { throw new ArgumentNullException("fixture"); } // get category attribute ImportanceAttribute imp = (ImportanceAttribute)TypeHelper.TryGetFirstCustomAttribute(fixture, typeof(ImportanceAttribute)); if (imp == null) { return((TestImportance.Default & this.Importance) == TestImportance.Default); } else { return((imp.Importance & this.Importance) == imp.Importance); } }