- gunit_bin_v2_10_1.zip
- release
- Algorithms
- NGraphviz.Layout.dll
- QuickGraph.Algorithms.dll
- QuickGraph.Collections.dll
- QuickGraph.Concepts.dll
- QuickGraph.Exceptions.dll
- QuickGraph.Predicates.dll
- DockingManagerExtender.dll
- GUnit.Core.dll
- GUnit.Forms.dll
- GUnit.Framework.dll
- GUnit.GUI.exe
- GUnit.GUI.exe.config
- GUnit.Tests.dll
- GUnit_doc.chm
- MagicLibrary.DLL
- Microsoft.ApplicationBlocks.ExceptionManagement.dll
- Microsoft.ApplicationBlocks.ExceptionManagement.Interfaces.dll
- Netron.dll
- NGraphviz.dll
- NGraphviz.Helpers.dll
- NGraphviz.Layout.dll
- ProdigeSoftware.Drawing.CommandBarAddIn.dll
- ProdigeSoftware.Drawing.dll
- QuickGraph.Algorithms.dll
- QuickGraph.Algorithms.Graphviz.dll
- QuickGraph.Collections.dll
- QuickGraph.Concepts.dll
- QuickGraph.dll
- QuickGraph.Exceptions.dll
- QuickGraph.Layout.dll
- QuickGraph.Layout.GUI.exe.config
- QuickGraph.Predicates.dll
- QuickGraph.Processors.dll
- QuickGraph.Representations.dll
- QuickGraph.Serialization.dll
- QuickGraph.UnitTests.dll
- gunit_demo.zip
- GUnit
- article.htm
- article
- GUnit.Cons
- GUnit.Core
- GUnit.Doc.chm
- GUnit.Forms
- GUnit.Framework
- GUnit.GUI
- GUnit.ndoc
- GUnit.sln
- GUnit.Tests
- GUnitAddIn
- QuickGraph
- Netron.dll
- NGraphviz.dll
- NGraphviz.Helpers.dll
- NGraphviz.Layout.dll
- QuickGraph.Algorithms.dll
- QuickGraph.Algorithms.Graphviz.dll
- QuickGraph.Applications.dll
- QuickGraph.Collections.dll
- QuickGraph.Concepts.dll
- QuickGraph.dll
- QuickGraph.Exceptions.dll
- QuickGraph.Layout.dll
- QuickGraph.Predicates.dll
- QuickGraph.Processors.dll
- QuickGraph.Representations.dll
- QuickGraph.Serialization.dll
|
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.1.4322.573
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </autogenerated>
//------------------------------------------------------------------------------
namespace GUnit.Core.Invokers
{
using System;
using System.Reflection;
using System.Xml;
using System.Xml.Serialization;
using System.IO;
using QuickGraph.Concepts;
using QuickGraph;
using QuickGraph.Representations;
using QuickGraph.Concepts.Providers;
using QuickGraph.Providers;
using QuickGraph.Algorithms;
using QuickGraph.Algorithms.Search;
using QuickGraph.Algorithms.Visitors;
using QuickGraph.Exceptions;
using QuickGraph.Serialization;
using QuickGraph.Collections;
using QuickGraph.Concepts.Collections;
using System.Diagnostics;
using GUnit.Core.Collections;
using GUnit.Core.Framework;
using GUnit.Core.Exceptions;
using GUnit.Core.Runs;
public class RunInvokerTree
{
private Type fixtureType;
private AdjacencyGraph graph = null;
private RunInvokerVertex root = null;
public RunInvokerTree(Type fixtureType)
{
if (fixtureType==null)
throw new ArgumentNullException("fixtureType");
this.fixtureType = fixtureType;
this.graph = new AdjacencyGraph(
new RunInvokerVertexProvider(),
new EdgeProvider(),
false
);
CreateRoot();
Reflect();
}
public Type FixtureType
{
get
{
return this.fixtureType;
}
}
public RunInvokerVertex Root
{
get
{
return this.root;
}
}
public AdjacencyGraph Graph
{
get
{
return this.graph;
}
}
public string Name
{
get
{
return this.fixtureType.Name;
}
}
protected void CreateRoot()
{
// create vertex
this.root = (RunInvokerVertex)this.graph.AddVertex();
}
protected void Reflect()
{
// get TestFixturePatternAttribute
TestFixturePatternAttribute fix =
(TestFixturePatternAttribute)TypeHelper.GetFirstCustomAttribute(
this.FixtureType,
typeof(TestFixturePatternAttribute)
);
// get run
TypeHelper.ShowMethodAttributes(this.FixtureType);
IRun run = fix.GetRun();
run.Reflect(this,this.Root,this.FixtureType);
}
public RunInvokerVertex AddChild(RunInvokerVertex parent, IRunInvoker child)
{
if (parent==null)
throw new ArgumentNullException("parent");
if (child==null)
throw new ArgumentNullException("child");
Debug.WriteLine(
String.Format("Add Child to {0}, {1}",parent.ToString(), child.ToString()));
// create vertex
RunInvokerVertex v = (RunInvokerVertex)this.graph.AddVertex();
v.Invoker = child;
// add edge
this.graph.AddEdge(parent,v);
Debug.WriteLine(
String.Format("Added Child {0}",v.ToString()));
return v;
}
public RunPipeCollection AllTestPipes()
{
ConstructorInfo ci = this.FixtureType.GetConstructor(Type.EmptyTypes);
if (ci==null)
throw new ConstructorNotFoundException(this.FixtureType,Type.EmptyTypes);
DepthFirstSearchAlgorithm dfs = new DepthFirstSearchAlgorithm(
this.graph
);
// attach leaf recorder
PredecessorRecorderVisitor pred = new PredecessorRecorderVisitor();
dfs.RegisterPredecessorRecorderHandlers(pred);
dfs.Compute(this.Root);
RunPipeCollection pipes =
new RunPipeCollection();
foreach(EdgeCollection edges in pred.AllPaths())
{
RunPipe pipe = new RunPipe(ci.Invoke(null));
foreach(IEdge e in edges)
{
pipe.Invokers.Add((RunInvokerVertex)e.Target);
}
pipes.Add(pipe);
}
return pipes;
}
public IVertexEnumerable Leaves(RunInvokerVertex v)
{
return AlgoUtility.Leaves(this.graph,v);
}
public override string ToString()
{
return String.Format("Tree: {0} tests, {1} transtions",
this.graph.VerticesCount,
this.graph.EdgesCount
);
}
public void ToXml(TextWriter writer)
{
if (writer==null)
throw new ArgumentNullException("writer");
GraphMLGraphSerializer ser = new GraphMLGraphSerializer("");
XmlTextWriter xmlWriter = new XmlTextWriter(writer);
xmlWriter.Formatting = Formatting.Indented;
ser.Serialize(xmlWriter,this.graph);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
Jonathan de Halleux is Civil Engineer in Applied Mathematics. He finished his PhD in 2004 in the rainy country of Belgium. After 2 years in the Common Language Runtime (i.e. .net), he is now working at Microsoft Research on Pex (http://research.microsoft.com/pex).