Here are the examples of the csharp api NUnit.Core.NamespaceTreeBuilder.BuildFromNameSpace(string) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
2 Examples
19
Source : NamespaceTreeBuilder.cs
with MIT License
from roozbehid
with MIT License
from roozbehid
public void Add( TestSuite fixture )
{
string ns = fixture.TestName.FullName;
int index = ns.LastIndexOf( '.' );
ns = index > 0 ? ns.Substring( 0, index ) : string.Empty;
TestSuite containingSuite = BuildFromNameSpace( ns );
if (fixture is SetUpFixture)
{
// The SetUpFixture must replace the namespace suite
// in which it is "contained".
//
// First, add the old suite's children
foreach (TestSuite child in containingSuite.Tests)
fixture.Add(child);
// Make the parent of the containing suite point to this
// fixture instead
// TODO: Get rid of this somehow?
TestSuite parent = (TestSuite)containingSuite.Parent;
if (parent == null)
{
fixture.TestName.Name = rootSuite.TestName.Name;
rootSuite = fixture;
}
else
{
parent.Tests.Remove(containingSuite);
parent.Add(fixture);
}
// Update the hashtable
namespaceSuites[ns] = fixture;
}
else
containingSuite.Add( fixture );
}
19
Source : NamespaceTreeBuilder.cs
with MIT License
from roozbehid
with MIT License
from roozbehid
private TestSuite BuildFromNameSpace( string nameSpace )
{
if( nameSpace == null || nameSpace == "" ) return rootSuite;
TestSuite suite = (TestSuite)namespaceSuites[nameSpace];
if(suite!=null) return suite;
int index = nameSpace.LastIndexOf(".");
//string prefix = string.Format( "[{0}]" );
if( index == -1 )
{
suite = new TestSuite( nameSpace );
if ( rootSuite == null )
rootSuite = suite;
else
rootSuite.Add(suite);
namespaceSuites[nameSpace]=suite;
}
else
{
string parentNameSpace = nameSpace.Substring( 0,index );
TestSuite parent = BuildFromNameSpace( parentNameSpace );
string suiteName = nameSpace.Substring( index+1 );
suite = new TestSuite( parentNameSpace, suiteName );
parent.Add( suite );
namespaceSuites[nameSpace] = suite;
}
return suite;
}