本文整理汇总了C#中NUnit.Core.TestSuiteBuilder.Build方法的典型用法代码示例。如果您正苦于以下问题:C# TestSuiteBuilder.Build方法的具体用法?C# TestSuiteBuilder.Build怎么用?C# TestSuiteBuilder.Build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NUnit.Core.TestSuiteBuilder
的用法示例。
在下文中一共展示了TestSuiteBuilder.Build方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetUp
public void SetUp()
{
TestSuiteBuilder builder = new TestSuiteBuilder();
suite = builder.Build( new TestPackage( testsDll ) );
treeView = new TestSuiteTreeView();
}
示例2: Hierarchy
public void Hierarchy()
{
TestSuiteBuilder builder = new TestSuiteBuilder();
Test suite = builder.Build( new TestPackage( testsDll ) );
suite = (Test)suite.Tests[0];
Assert.AreEqual("NUnit", suite.TestName.Name);
suite = (Test)suite.Tests[0];
Assert.AreEqual("Tests", suite.TestName.Name);
Assert.AreEqual(MockAssembly.Fixtures, suite.Tests.Count);
Test singletonSuite = TestFinder.Find("Singletons", suite, false);
Assert.AreEqual(1, singletonSuite.Tests.Count);
Test mockSuite = TestFinder.Find("Assemblies", suite, false);
Assert.AreEqual(1, mockSuite.Tests.Count);
Test mockFixtureSuite = TestFinder.Find("MockTestFixture", mockSuite, false);
Assert.AreEqual(MockTestFixture.Tests, mockFixtureSuite.Tests.Count);
foreach(Test t in mockFixtureSuite.Tests)
{
Assert.IsFalse(t.IsSuite, "Should not be a suite");
}
}
示例3: LoadTestFixtureFromAssembly
public void LoadTestFixtureFromAssembly()
{
TestSuiteBuilder builder = new TestSuiteBuilder();
TestPackage package = new TestPackage( testsDll );
package.TestName = "NUnit.Tests.Assemblies.MockTestFixture";
Test suite= builder.Build( package );
Assert.IsNotNull(suite);
}
示例4: CanAddAllAvailableCategoriesInTestTree
public void CanAddAllAvailableCategoriesInTestTree()
{
TestSuiteBuilder builder = new TestSuiteBuilder();
Test suite = builder.Build( new TestPackage( "mock-assembly.dll" ) );
categoryManager.AddAllCategories( suite );
//Assert.AreEqual( MockAssembly.Categories, categoryManager.Categories.Count );
}
示例5: Setup
public void Setup()
{
progressBar = new TestProgressBar();
TestSuiteBuilder builder = new TestSuiteBuilder();
suite = new TestNode( builder.Build( new TestPackage( testsDll ) ) );
mockEvents = new MockTestEventSource( suite );
}
示例6: Setup
public void Setup()
{
statusBar = new StatusBar();
TestSuiteBuilder builder = new TestSuiteBuilder();
suite = builder.Build( new TestPackage( testsDll ) );
mockEvents = new MockTestEventSource( suite );
}
示例7: CanAddTestCategories
public void CanAddTestCategories()
{
TestSuiteBuilder builder = new TestSuiteBuilder();
Test suite = builder.Build( new TestPackage( "mock-assembly.dll" ) );
Test test = TestFinder.Find( "MockTest3", suite );
categoryManager.AddCategories( test );
Assert.AreEqual( 2, categoryManager.Categories.Count );
}
示例8: PrepareTestSuite
private TestSuite PrepareTestSuite(List<String> assemblyList)
{
CoreExtensions.Host.InitializeService();
var testPackage = new TestPackage("Unity",
assemblyList);
var builder = new TestSuiteBuilder();
TestExecutionContext.CurrentContext.TestPackage = testPackage;
TestSuite suite = builder.Build(testPackage);
return suite;
}
示例9: NoNamespaceInAssembly
public void NoNamespaceInAssembly()
{
TestSuiteBuilder builder = new TestSuiteBuilder();
Test suite = builder.Build( new TestPackage( nonamespaceDLL ) );
Assert.IsNotNull(suite);
Assert.AreEqual( NoNamespaceTestFixture.Tests, suite.TestCount );
suite = (TestSuite)suite.Tests[0];
Assert.IsNotNull(suite);
Assert.AreEqual( "NoNamespaceTestFixture", suite.TestName.Name );
Assert.AreEqual( "NoNamespaceTestFixture", suite.TestName.FullName );
}
示例10: RunMockTests
public void RunMockTests()
{
string testsDll = NUnit.Tests.Assemblies.MockAssembly.AssemblyPath;
TestSuiteBuilder suiteBuilder = new TestSuiteBuilder();
Test suite = suiteBuilder.Build( new TestPackage( testsDll ) );
TestResult result = suite.Run(NullListener.NULL, TestFilter.Empty);
StringBuilder builder = new StringBuilder();
new XmlResultWriter(new StringWriter(builder)).SaveTestResult(result);
string resultXml = builder.ToString();
resultDoc = new XmlDocument();
resultDoc.LoadXml(resultXml);
}
示例11: Hierarchy
public void Hierarchy()
{
TestSuiteBuilder builder = new TestSuiteBuilder();
Test suite = builder.Build( new TestPackage( testsDll ) );
IList tests = suite.Tests;
Assert.AreEqual(1, tests.Count);
Assert.IsTrue(tests[0] is TestSuite, "TestSuite:NUnit - is not correct");
TestSuite testSuite = (TestSuite)tests[0];
Assert.AreEqual("NUnit", testSuite.TestName.Name);
tests = testSuite.Tests;
Assert.IsTrue(tests[0] is TestSuite, "TestSuite:Tests - is invalid");
testSuite = (TestSuite)tests[0];
Assert.AreEqual(1, tests.Count);
Assert.AreEqual("Tests", testSuite.TestName.Name);
tests = testSuite.Tests;
// TODO: Get rid of constants in this test
Assert.AreEqual(MockAssembly.Fixtures, tests.Count);
Assert.IsTrue(tests[3] is TestSuite, "TestSuite:singletons - is invalid");
TestSuite singletonSuite = (TestSuite)tests[3];
Assert.AreEqual("Singletons", singletonSuite.TestName.Name);
Assert.AreEqual(1, singletonSuite.Tests.Count);
Assert.IsTrue(tests[0] is TestSuite, "TestSuite:assemblies - is invalid");
TestSuite mockSuite = (TestSuite)tests[0];
Assert.AreEqual("Assemblies", mockSuite.TestName.Name);
TestSuite mockFixtureSuite = (TestSuite)mockSuite.Tests[0];
Assert.AreEqual(MockTestFixture.Tests, mockFixtureSuite.Tests.Count);
IList mockTests = mockFixtureSuite.Tests;
foreach(Test t in mockTests)
{
Assert.IsTrue(t is NUnit.Core.TestCase, "should be a TestCase");
}
}
示例12: Execute
public Result Execute(ExternalCommandData revit, ref string message, ElementSet elements)
{
DynamoLogger.Instance.StartLogging();
try
{
m_revit = revit.Application;
m_doc = m_revit.ActiveUIDocument;
#region default level
Level defaultLevel = null;
var fecLevel = new FilteredElementCollector(m_doc.Document);
fecLevel.OfClass(typeof(Level));
defaultLevel = fecLevel.ToElements()[0] as Level;
#endregion
dynRevitSettings.Revit = m_revit;
dynRevitSettings.Doc = m_doc;
dynRevitSettings.DefaultLevel = defaultLevel;
//create dynamo
Regex r = new Regex(@"\b(Autodesk |Structure |MEP |Architecture )\b");
string context = r.Replace(m_revit.Application.VersionName, "");
var dynamoController = new DynamoController_Revit(DynamoRevitApp.env, DynamoRevitApp.updater, typeof(DynamoRevitViewModel), context);
//flag to run evalauation synchronously, helps to
//avoid threading issues when testing.
dynamoController.Testing = true;
//execute the tests
Results = new DynamoRevitTestRunner();
DynamoRevitTestResultsView resultsView = new DynamoRevitTestResultsView();
resultsView.DataContext = Results;
//http://stackoverflow.com/questions/2798561/how-to-run-nunit-from-my-code
string assLocation = Assembly.GetExecutingAssembly().Location;
FileInfo fi = new FileInfo(assLocation);
string testLoc = Path.Combine(fi.DirectoryName, @"DynamoRevitTester.dll");
//Tests must be executed on the main thread in order to access the Revit API.
//NUnit's SimpleTestRunner runs the tests on the main thread
//http://stackoverflow.com/questions/16216011/nunit-c-run-specific-tests-through-coding?rq=1
CoreExtensions.Host.InitializeService();
SimpleTestRunner runner = new SimpleTestRunner();
TestSuiteBuilder builder = new TestSuiteBuilder();
TestPackage package = new TestPackage("DynamoRevitTests", new List<string>() { testLoc });
runner.Load(package);
TestSuite suite = builder.Build(package);
TestFixture fixture = null;
FindFixtureByName(out fixture, suite, "DynamoRevitTests");
if (fixture == null)
throw new Exception("Could not find DynamoRevitTests fixture.");
foreach (var t in fixture.Tests)
{
if (t is ParameterizedMethodSuite)
{
var paramSuite = t as ParameterizedMethodSuite;
foreach (var tInner in paramSuite.Tests)
{
if (tInner is TestMethod)
Results.Results.Add(new DynamoRevitTest(tInner as TestMethod));
}
}
else if (t is TestMethod)
Results.Results.Add(new DynamoRevitTest(t as TestMethod));
}
resultsView.ShowDialog();
}
catch (Exception ex)
{
Debug.WriteLine(ex.ToString());
return Result.Failed;
}
return Result.Succeeded;
}
示例13: InitPluginModule
/// <summary>
/// InitPluginModule : called at plugin initialisation time: Add the relevant shape creators here
/// </summary>
public override bool InitPluginModule()
{
TerrainManaged.ManagedModule.InitManagedModule();
EDITOR_PLUGIN_INFO.NativePluginNames = new string[] { "VisionEnginePlugin" };
TerrainEditor.Init();
// Add IShapeCreatorPlugin
_heightFieldCreator = new TerrainShapeCreator();
EditorManager.ShapeCreatorPlugins.Add(_heightFieldCreator);
// add default filter:
TerrainEditor.HeightmapImporterList.Add(new ImportHeightmapTEX16bpp());
TerrainEditor.HeightmapImporterList.Add(new ImportHeightmapRAW());
TerrainEditor.HeightmapImporterList.Add(new ImportHeightmapDDS());
TerrainEditor.HeightmapFilterList.Add(new HeightmapClearFilter());
TerrainEditor.HeightmapFilterList.Add(new HeightmapScaleElevateFilter());
TerrainEditor.DecorationFilterList.Add(new DecorationClearFilter());
TerrainEditor.DecorationFilterList.Add(new DecorationImportFromLuminanceFilter());
TerrainEditor.DecorationFilterList.Add(new DecorationFromDetailTextureFilter());
TerrainEditor.DecorationFilterList.Add(new DecorationFromSlopeFilter());
// create panel
_panel = new TerrainEditorPanel(EditorManager.ApplicationLayout.DockingArea);
_panel.ShowDockable();
TerrainEditor.EditorPanel = _panel;
// register tests:
TestSuiteBuilder testBuilder = new TestSuiteBuilder();
TestSuite testSuite = testBuilder.Build(typeof(EditorPlugin).Assembly.FullName);
TestManager.AddTestSuite(testSuite);
return true;
}
示例14: RunMockTests
public void RunMockTests()
{
string testsDll = "mock-assembly.dll";
TestSuiteBuilder suiteBuilder = new TestSuiteBuilder();
Test suite = suiteBuilder.Build( new TestPackage( testsDll ) );
TestResult result = suite.Run(NullListener.NULL);
StringBuilder builder = new StringBuilder();
StringWriter writer = new StringWriter(builder);
XmlResultVisitor visitor = new XmlResultVisitor(writer, result);
result.Accept(visitor);
visitor.Write();
string resultXml = builder.ToString();
Console.WriteLine(resultXml);
resultDoc = new XmlDocument();
resultDoc.LoadXml(resultXml);
}
示例15: CanReloadAfterTurningOffAutoNamespaces
public void CanReloadAfterTurningOffAutoNamespaces()
{
TestSuiteBuilder builder = new TestSuiteBuilder();
TestPackage package = new TestPackage(testsDll);
package.Settings["AutoNamespaceSuites"] = false;
TestSuite suite2 = builder.Build(package);
Assert.AreEqual(originalTestCount, suite2.TestCount);
Assert.AreEqual(MockAssembly.Classes, suite2.Tests.Count);
ReassignTestIDsAndReload(suite2);
CheckTreeAgainstSuite(suite2, "after turning automatic namespaces OFF");
// TODO: This currently doesn't work
//ReassignTestIDsAndReload(suite);
//CheckTreeAgainstSuite(suite, "after turning automatic namespaces ON");
}