public void LoadAssembly() { Test suite = builder.Build(new TestPackage(testsDll)); Assert.IsNotNull(suite, "Unable to build suite"); Assert.AreEqual(1, suite.Tests.Count); Assert.AreEqual("NUnit", ((ITest)suite.Tests[0]).TestName.Name); }
private void runSchemaValidatorTest(TextWriter writer, CultureInfo testCulture) { // Preserve current culture CultureInfo previousCulture = Thread.CurrentThread.CurrentCulture; // Enable test culture Thread.CurrentThread.CurrentCulture = testCulture; try { string testsDll = "mock-assembly.dll"; TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build(new TestPackage(testsDll)); TestResult result = suite.Run(NullListener.NULL); XmlResultVisitor visitor = new XmlResultVisitor(writer, result); result.Accept(visitor); visitor.Write(); } finally { // Restore previous culture Thread.CurrentThread.CurrentCulture = previousCulture; } }
private void runSchemaValidatorTest(string reportFileName, CultureInfo testCulture) { // Preserve current culture CultureInfo previousCulture = Thread.CurrentThread.CurrentCulture; // Enable test culture Thread.CurrentThread.CurrentCulture = testCulture; try { string testsDll = "mock-assembly.dll"; TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build(new TestPackage(testsDll)); TestResult result = suite.Run(NullListener.NULL); XmlResultVisitor visitor = new XmlResultVisitor(reportFileName, result); result.Accept(visitor); visitor.Write(); SchemaValidator validator = new SchemaValidator(reportFileName, schemaFile.Path); Assert.IsTrue(validator.Validate(), "validate failed"); } finally { // Restore previous culture Thread.CurrentThread.CurrentCulture = previousCulture; } }
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"); } }
public void LoadAssembly() { TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build( new TestPackage( thisDll ) ); Assert.IsNotNull(suite, "Unable to load " + thisDll); Assert.IsTrue( File.Exists( thisDll ), "Load does not set current Directory" ); }
public void LoadTestFixtureFromAssembly() { TestSuiteBuilder builder = new TestSuiteBuilder(); TestSuite suite = builder.Build(testsDll, "NUnit.Tests.Assemblies.MockTestFixture"); Assert.IsNotNull(suite); }
public void TestRoot() { TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build(new TestPackage(testsDll)); Assert.AreEqual(testsDll, suite.TestName.Name); }
public TestCollection[] LoadTests(string filename) { var results = new List <TestCollection>(); var package = new TestPackage(filename); CoreExtensions.Host.InitializeService(); var builder = new TestSuiteBuilder(); var suite = builder.Build(package); foreach (object test in suite.Tests) { var testSuite = test as TestSuite; if (testSuite == null) { continue; } results.AddRange(GetSteps(testSuite)); } CoreExtensions.Host.UnloadService(); return(results.ToArray()); }
public void LoadTestFixtureFromAssembly() { TestSuiteBuilder builder = new TestSuiteBuilder(); TestSuite suite = builder.Build(testsDll, "NUnit.Tests.Assemblies.AssemblyTests"); Assert.IsNotNull(suite, "Should not be Null"); }
public void NamespaceSetUpFixtureReplacesNamespaceNodeInTree() { string nameSpace = "NUnit.TestData.SetupFixture.Namespace1"; TestSuiteBuilder builder = new TestSuiteBuilder(); TestPackage package = new TestPackage( testAssembly ); package.TestName = nameSpace; Test suite= builder.Build( package ); Assert.IsNotNull(suite); Assert.AreEqual(testAssembly, suite.TestName.Name); Assert.AreEqual(1, suite.Tests.Count); string[] nameSpaceBits = nameSpace.Split('.'); for (int i = 0; i < nameSpaceBits.Length; i++) { suite = suite.Tests[0] as TestSuite; Assert.AreEqual(nameSpaceBits[i], suite.TestName.Name); Assert.AreEqual(1, suite.Tests.Count); } Assert.IsInstanceOf(typeof(SetUpFixture), suite); suite = suite.Tests[0] as TestSuite; Assert.AreEqual("SomeTestFixture", suite.TestName.Name); Assert.AreEqual(1, suite.Tests.Count); }
[SetUp] public void LoadFixture() { string testsDll = "nunit.tests.dll"; TestSuiteBuilder builder = new TestSuiteBuilder(); suite = builder.Build(testsDll, "NUnit.Tests.Core.TestFixtureExtension+DerivedTestFixture"); }
/// <summary> /// Overridden function that gets called when the plugin is loaded. Registers all creator plugins /// </summary> /// <returns></returns> public override bool InitPluginModule() { EDITOR_PLUGIN_INFO.NativePluginNames = new string[] { "Havok" }; HavokManaged.ManagedModule.InitManagedModule(); StaticMeshShape.UsesCollisionGroups = true; // switch to displaying collision groups // register shape classes creators = new IShapeCreatorPlugin[] { new HavokConstraintShapeCreator(), new HavokConstraintChainShapeCreator(), new HavokResourceShapeCreator() }; foreach (IShapeCreatorPlugin plugin in creators) { EditorManager.ShapeCreatorPlugins.Add(plugin); } // create and activate panel _panel = new HavokPhysicsPanel(EditorManager.ApplicationLayout.DockingArea); _panel.ShowDockable(); // Register automated tests TestSuiteBuilder testBuilder = new TestSuiteBuilder(); TestSuite testSuite = testBuilder.Build(typeof(EditorPlugin).Assembly.FullName); TestManager.AddTestSuite(testSuite); IProject.ProjectUnloaded += new EventHandler(IProject_ProjectUnloaded); return(true); }
public void NamespaceSetUpFixtureReplacesNamespaceNodeInTree() { string nameSpace = "NUnit.TestData.SetupFixture.Namespace1"; TestSuiteBuilder builder = new TestSuiteBuilder(); TestPackage package = new TestPackage(testAssembly); package.TestName = nameSpace; Test suite = builder.Build(package); Assert.IsNotNull(suite); Assert.AreEqual(testAssembly, suite.TestName.Name); Assert.AreEqual(1, suite.Tests.Count); string[] nameSpaceBits = nameSpace.Split('.'); for (int i = 0; i < nameSpaceBits.Length; i++) { suite = suite.Tests[0] as TestSuite; Assert.AreEqual(nameSpaceBits[i], suite.TestName.Name); Assert.AreEqual(1, suite.Tests.Count); } Assert.IsInstanceOfType(typeof(SetUpFixture), suite); suite = suite.Tests[0] as TestSuite; Assert.AreEqual("SomeTestFixture", suite.TestName.Name); Assert.AreEqual(1, suite.Tests.Count); }
[SetUp] public void LoadFixture() { string testsDll = AssemblyHelper.GetAssemblyPath(typeof(DerivedTestFixture)); TestSuiteBuilder builder = new TestSuiteBuilder(); TestPackage package = new TestPackage( testsDll ); package.TestName = typeof(DerivedTestFixture).FullName; suite= builder.Build( package ); }
public void Setup() { TestSuiteBuilder builder = new TestSuiteBuilder(); TestPackage package = new TestPackage(AssemblyHelper.GetAssemblyPath(typeof(ActionAttributeExceptionFixture))); package.TestName = typeof(ActionAttributeExceptionFixture).Namespace; _Suite = builder.Build(package); }
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); }
private TestResult runTests(string nameSpace, TestFilter filter) { TestSuiteBuilder builder = new TestSuiteBuilder(); TestPackage package = new TestPackage( testAssembly ); package.TestName = nameSpace; Test suite = builder.Build( package ); return suite.Run(new NullListener(),filter); }
[SetUp] public void LoadFixture() { string testsDll = "test-assembly.dll"; TestSuiteBuilder builder = new TestSuiteBuilder(); TestPackage package = new TestPackage( testsDll ); package.TestName = "NUnit.TestData.TestFixtureExtension.DerivedTestFixture"; suite= builder.Build( package ); }
private TestSuite LoadFixture(string fixtureName) { TestSuite suite = builder.Build(testsDll, fixtureName); Assert.IsNotNull(suite); return(suite); }
public void SetUp() { TestSuiteBuilder builder = new TestSuiteBuilder(); suite = builder.Build(new TestPackage(testsDll)); treeView = new TestSuiteTreeView(); }
public void LoadTestFixtureFromAssembly() { TestSuiteBuilder builder = new TestSuiteBuilder(); TestPackage package = new TestPackage( thisDll ); package.TestName = this.GetType().FullName; Test suite= builder.Build( package ); Assert.IsNotNull(suite, "Should not be Null"); }
public void LoadAssemblyWithoutTestFixtures() { TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build( new TestPackage( noTestFixturesDll ) ); Assert.IsNotNull(suite, "Unable to load " + noTestFixturesDll); Assert.AreEqual(RunState.Runnable, suite.RunState); Assert.AreEqual( 0, suite.Tests.Count ); }
public void LoadAssembly() { TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build(new TestPackage(thisDll)); Assert.IsNotNull(suite, "Unable to load " + thisDll); Assert.IsTrue(File.Exists(thisDll), "Load does not set current Directory"); }
public static TestSuite GetTestSuite(string assemblyName) { TestSuiteBuilder builder = new TestSuiteBuilder(); string packagePath = string.Format(@"{0}\{1}.dll", Constants.ExecutionRoot, assemblyName); TestPackage testPackage = new TestPackage(packagePath); TestSuite suite = builder.Build(testPackage); return(suite); }
[SetUp] public void LoadFixture() { string testsDll = AssemblyHelper.GetAssemblyPath(typeof(DerivedTestFixture)); TestSuiteBuilder builder = new TestSuiteBuilder(); TestPackage package = new TestPackage(testsDll); package.TestName = typeof(DerivedTestFixture).FullName; suite = builder.Build(package); }
public void LoadAssemblyWithoutTestFixtures() { TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build(new TestPackage(noTestFixturesDll)); Assert.IsNotNull(suite, "Unable to load " + noTestFixturesDll); Assert.AreEqual(RunState.Runnable, suite.RunState); Assert.AreEqual(0, suite.Tests.Count); }
[SetUp] public void LoadFixture() { string testsDll = "test-assembly.dll"; TestSuiteBuilder builder = new TestSuiteBuilder(); TestPackage package = new TestPackage(testsDll); package.TestName = "NUnit.TestData.TestFixtureExtension.DerivedTestFixture"; suite = builder.Build(package); }
private void runSchemaValidatorTest(TextWriter writer) { string testsDll = NUnit.Tests.Assemblies.MockAssembly.AssemblyPath; TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build(new TestPackage(testsDll)); TestResult result = suite.Run(NullListener.NULL, TestFilter.Empty); new XmlResultWriter(writer).SaveTestResult(result); }
public void LoadAssemblyWithoutTestFixtures() { string fileName = "notestfixtures-assembly.dll"; TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build( new TestPackage( fileName ) ); Assert.IsNotNull( suite,"Should not be null" ); Assert.AreEqual( RunState.NotRunnable, suite.RunState ); Assert.AreEqual( suite.IgnoreReason, "Has no TestFixtures" ); Assert.AreEqual( 0, suite.Tests.Count ); }
private TestResult test(CompilerResults results) { CoreExtensions.Host.InitializeService(); var package = new TestPackage(results.PathToAssembly); var builder = new TestSuiteBuilder(); TestSuite suite = builder.Build(package); TestResult test = suite.Run(NullListener.NULL, TestFilter.Empty); return(test); }
public void LoadFixture() { TestPackage package = new TestPackage("Multiple Assemblies", assemblies); package.TestName = "NUnit.Tests.Assemblies.MockTestFixture"; TestSuite suite = builder.Build(package); Assert.IsNotNull(suite); Assert.AreEqual(MockTestFixture.Tests, suite.TestCount); }
public void Setup() { statusBar = new StatusBar(); TestSuiteBuilder builder = new TestSuiteBuilder(); suite = builder.Build(new TestPackage(testsDll)); mockEvents = new MockTestEventSource(suite); }
public void Setup() { progressBar = new TestProgressBar(); TestSuiteBuilder builder = new TestSuiteBuilder(); suite = new TestNode(builder.Build(new TestPackage(testsDll))); mockEvents = new MockTestEventSource(suite); }
private TestResult runTests(string nameSpace, TestFilter filter) { TestSuiteBuilder builder = new TestSuiteBuilder(); TestPackage package = new TestPackage(testAssembly); package.TestName = nameSpace; Test suite = builder.Build(package); return(suite.Run(new NullListener(), filter)); }
public void LoadTestFixtureFromAssembly() { TestSuiteBuilder builder = new TestSuiteBuilder(); TestPackage package = new TestPackage(thisDll); package.TestName = this.GetType().FullName; Test suite = builder.Build(package); Assert.IsNotNull(suite, "Should not be Null"); }
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); }
public void Setup() { progressBar = new ProgressBar(); TestSuiteBuilder builder = new TestSuiteBuilder(); suite = builder.Build(testsDll); mockEvents = new MockTestEventSource(testsDll, suite); }
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); }
private void buildTestSuiteToolStripMenuItem_Click(object sender, EventArgs e) { var tsCreate = new TestSuiteCreate(); tsCreate.Actual.QueriesDirectory = Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.Query].FullFileName; tsCreate.Actual.ConnectionString = Configuration.Project.ConnectionStrings[ Configuration.ConnectionStringCollection.ConnectionClass.Oledb, Configuration.ConnectionStringCollection.ConnectionType.Expect ].Value; tsCreate.Expect.ResultSetsDirectory = Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.Expect].FullFileName; DialogResult dialogResult = tsCreate.ShowDialog(); if (dialogResult.HasFlag(DialogResult.OK)) { StartClick(null); try { var tsb = new TestSuiteBuilder(); TestSuiteXml ts = null; tsb.DefineActual(tsCreate.Actual.QueriesDirectory, tsCreate.Actual.ConnectionString); if (tsCreate.Expect.IsResultSetsBased) tsb.DefineExpect(tsCreate.Expect.ResultSetsDirectory); else tsb.DefineExpect(tsCreate.Expect.QueriesDirectory, tsCreate.Expect.ConnectionString); ts = tsb.Build(); var xm = new XmlManager(); using (var sfd = new SaveFileDialog()) { sfd.InitialDirectory = Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.TestSuite].FullPath; sfd.FileName = Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.TestSuite].FilenameWithoutExtension; sfd.Filter = "Xml|*.xml"; if (sfd.ShowDialog() == DialogResult.OK) { Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.TestSuite].FullFileName = sfd.FileName; xm.Persist(sfd.FileName, ts); } } } finally { Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.Query].FullFileName = tsCreate.Actual.QueriesDirectory; Configuration.Project.ConnectionStrings[ Configuration.ConnectionStringCollection.ConnectionClass.Oledb, Configuration.ConnectionStringCollection.ConnectionType.Actual ].Value = tsCreate.Actual.ConnectionString; if (tsCreate.Expect.IsResultSetsBased) Configuration.Project.Directories[Configuration.DirectoryCollection.DirectoryType.Expect].FullFileName = tsCreate.Expect.ResultSetsDirectory; EndClick(null); } } }
public void Setup() { ActionAttributeFixture.Results = new List<string>(); TestSuiteBuilder builder = new TestSuiteBuilder(); TestPackage package = new TestPackage(AssemblyHelper.GetAssemblyPath(typeof(ActionAttributeFixture))); package.TestName = typeof(ActionAttributeFixture).Namespace; Test suite = builder.Build(package); _result = suite.Run(new NullListener(), new ActionAttributeFixtureFilter()); }
public void AssemblySetUpFixtureReplacesAssemblyNodeInTree() { TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build( new TestPackage( testAssembly ) ); Assert.IsNotNull(suite); Assert.IsInstanceOf(typeof(SetUpFixture), suite); suite = suite.Tests[1] as TestSuite; Assert.AreEqual("SomeTestFixture", suite.TestName.Name); Assert.AreEqual(1, suite.TestCount); }
public void CheckEventListening() { TestSuiteBuilder builder = new TestSuiteBuilder(); Test testSuite = builder.Build( new TestPackage( testsDll ) ); EventCounter counter = new EventCounter(); testSuite.Run(counter, TestFilter.Empty); Assert.AreEqual(testSuite.CountTestCases(TestFilter.Empty), counter.testCaseStart); Assert.AreEqual(testSuite.CountTestCases(TestFilter.Empty), counter.testCaseFinished); Assert.AreEqual(MockAssembly.SuitesRun, counter.suiteStarted); Assert.AreEqual(MockAssembly.SuitesRun, counter.suiteFinished); }
private void runSchemaValidatorTest(TextWriter writer, CultureInfo testCulture) { // Preserve current culture CultureInfo previousCulture = Thread.CurrentThread.CurrentCulture; // Enable test culture Thread.CurrentThread.CurrentCulture = testCulture; try { string testsDll = "mock-assembly.dll"; TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build( new TestPackage( testsDll ) ); TestResult result = suite.Run(NullListener.NULL); XmlResultVisitor visitor = new XmlResultVisitor(writer, result); result.Accept(visitor); visitor.Write(); } finally { // Restore previous culture Thread.CurrentThread.CurrentCulture = previousCulture; } }
private void runSchemaValidatorTest(TextWriter writer) { string testsDll = "mock-assembly.dll"; TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build( new TestPackage( testsDll ) ); TestResult result = suite.Run(NullListener.NULL); XmlResultVisitor visitor = new XmlResultVisitor(writer, result); result.Accept(visitor); visitor.Write(); }
private void runSchemaValidatorTest(string reportFileName, CultureInfo testCulture) { // Preserve current culture CultureInfo previousCulture = Thread.CurrentThread.CurrentCulture; // Enable test culture Thread.CurrentThread.CurrentCulture = testCulture; try { string testsDll = "mock-assembly.dll"; TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build( new TestPackage( testsDll ) ); TestResult result = suite.Run(NullListener.NULL); XmlResultVisitor visitor = new XmlResultVisitor(reportFileName, result); result.Accept(visitor); visitor.Write(); SchemaValidator validator = new SchemaValidator(reportFileName, schemaFile.Path); Assert.IsTrue(validator.Validate(), "validate failed"); } finally { // Restore previous culture Thread.CurrentThread.CurrentCulture = previousCulture; } }
public void LoadAssemblyNotFound() { TestSuiteBuilder builder = new TestSuiteBuilder(); builder.Build( new TestPackage( "/XXXX.dll" ) ); }
private void runSchemaValidatorTest(string reportFileName) { string testsDll = "mock-assembly.dll"; TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build( new TestPackage( testsDll ) ); TestResult result = suite.Run(NullListener.NULL); XmlResultVisitor visitor = new XmlResultVisitor(reportFileName, result); result.Accept(visitor); visitor.Write(); SchemaValidator validator = new SchemaValidator(reportFileName, schemaFile.Path); Assert.IsTrue(validator.Validate(), "validate failed"); }
private void runSchemaValidatorTest(string reportFileName) { string testsDll = "mock-assembly.dll"; TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build( new TestPackage( testsDll ) ); TestResult result = suite.Run(NullListener.NULL, TestFilter.Empty); new XmlResultWriter(reportFileName).SaveTestResult(result); SchemaValidator validator = new SchemaValidator(reportFileName, schemaFile.Path); Assert.IsTrue(validator.Validate(), "validate failed"); }
private void runSchemaValidatorTest(TextWriter writer) { string testsDll = "mock-assembly.dll"; TestSuiteBuilder builder = new TestSuiteBuilder(); Test suite = builder.Build( new TestPackage( testsDll ) ); TestResult result = suite.Run(NullListener.NULL, TestFilter.Empty); new XmlResultWriter(writer).SaveTestResult(result); }