当前位置: 首页>>代码示例>>C#>>正文


C# Core.TestSuiteBuilder类代码示例

本文整理汇总了C#中NUnit.Core.TestSuiteBuilder的典型用法代码示例。如果您正苦于以下问题:C# TestSuiteBuilder类的具体用法?C# TestSuiteBuilder怎么用?C# TestSuiteBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TestSuiteBuilder类属于NUnit.Core命名空间,在下文中一共展示了TestSuiteBuilder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
      // Initialise data table to hold test results
      _results.Columns.Add("test");
      _results.Columns.Add("result");
      _results.Columns.Add("time");
      _results.Columns.Add("message");
      _results.Columns.Add("class");

      // Initialise controls
      lblResult.Text = "";
      ltlStats.Text = "";

      // Initialise NUnit
      CoreExtensions.Host.InitializeService();

      // Find tests in current assembly
      _testPackage = new TestPackage(Assembly.GetExecutingAssembly().Location);

      if (!IsPostBack)
      {
        var testSuite = new TestSuiteBuilder().Build(_testPackage);
        var categoryManager = new CategoryManager();
        categoryManager.AddAllCategories(testSuite);

        cblCategories.DataSource = (from string cat in categoryManager.Categories select cat).OrderBy(x => x);
        cblCategories.DataBind();
      }
    }
开发者ID:KerwinMa,项目名称:revolver,代码行数:29,代码来源:Test.aspx.cs

示例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");
            }
        }
开发者ID:torkelo,项目名称:shouldly,代码行数:26,代码来源:NamespaceAssemblyTests.cs

示例3: SetUp

		public void SetUp() 
		{
			TestSuiteBuilder builder = new TestSuiteBuilder();
			suite = builder.Build( new TestPackage( testsDll ) );

			treeView = new TestSuiteTreeView();
		}
开发者ID:Phaiax,项目名称:dotnetautoupdate,代码行数:7,代码来源:TestSuiteTreeViewFixture.cs

示例4: GetTestInfo

		public NunitTestInfo GetTestInfo (string path, List<string> supportAssemblies)
		{
			InitSupportAssemblies (supportAssemblies);
			
			TestSuite rootTS = new TestSuiteBuilder ().Build (new TestPackage (path));
			return BuildTestInfo (rootTS);
		}
开发者ID:transformersprimeabcxyz,项目名称:monodevelop-1,代码行数:7,代码来源:NUnitTestRunner.cs

示例5: 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);
 }
开发者ID:torkelo,项目名称:shouldly,代码行数:8,代码来源:NamespaceAssemblyTests.cs

示例6: 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 );
        }
开发者ID:taoxiease,项目名称:asegrp,代码行数:8,代码来源:CategoryManagerTest_Pex.cs

示例7: Setup

        public void Setup()
        {
            progressBar = new TestProgressBar();

            TestSuiteBuilder builder = new TestSuiteBuilder();
            suite = new TestNode( builder.Build( new TestPackage( testsDll ) ) );

            mockEvents = new MockTestEventSource( suite );
        }
开发者ID:taoxiease,项目名称:asegrp,代码行数:9,代码来源:ProgressBarTests.cs

示例8: 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 );
        }
开发者ID:taoxiease,项目名称:asegrp,代码行数:9,代码来源:CategoryManagerTest_Pex.cs

示例9: Setup

		public void Setup()
		{
			statusBar = new StatusBar();

			TestSuiteBuilder builder = new TestSuiteBuilder();
			suite = builder.Build( new TestPackage( testsDll ) );

			mockEvents = new MockTestEventSource( suite );
		}
开发者ID:rmterra,项目名称:AutoTest.Net,代码行数:9,代码来源:StatusBarTests.cs

示例10: 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;
		}
开发者ID:eyalzur,项目名称:CodeSamplesPublic,代码行数:11,代码来源:NUnitTestEngine.cs

示例11: RunTestsOnAssembly

        /// <summary>
        ///     Runs NUnit-compatible unit tests in an assembly in a debugger-friendly way.</summary>
        /// <param name="assembly">
        ///     The assembly containing the unit tests to run.</param>
        /// <param name="suppressTimesInLog">
        ///     Indicates whether to suppress the timing information in the log output produced. Defaults to <c>false</c>.</param>
        /// <param name="filter">
        ///     If not <c>null</c> (the default), only tests that match this regular expression are run.</param>
        public static void RunTestsOnAssembly(Assembly assembly, bool suppressTimesInLog = false, string filter = null)
        {
            var package = new TestPackage(assembly.Location);
            if (!CoreExtensions.Host.Initialized)
                CoreExtensions.Host.InitializeService();

            var testsIndirect = new TestSuiteBuilder().Build(package);
            var tests = directize(testsIndirect, filter);

            var results = new TestResult(tests);
            tests.Run(results, new DirectListener(suppressTimesInLog), TestFilter.Empty);
        }
开发者ID:RT-Projects,项目名称:RT.NUnitDirect,代码行数:20,代码来源:Direct.cs

示例12: 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 );
        }
开发者ID:torkelo,项目名称:shouldly,代码行数:12,代码来源:NamespaceAssemblyTests.cs

示例13: 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);
		}
开发者ID:Vernathic,项目名称:ic-AutoTest.NET4CTDD,代码行数:15,代码来源:XmlResultWriterTest.cs

示例14: RunnerHandler

        public RunnerHandler(string prefix, List<string> assemblies, string testResult)
        {
            this.prefix = prefix;

            var codeBase = Assembly.GetExecutingAssembly().CodeBase;
            var directoryName = Path.GetDirectoryName(codeBase);
            if (directoryName == null) throw new DirectoryNotFoundException("Unable to determine running location for test runner");

            // Ensure the assembly path exists
            var currentDirectory = new Uri(directoryName).LocalPath;

            assemblyList = new List<string>();
            foreach (var assemblyName in assemblies)
            {
                var assemblypath = Path.GetFullPath(Path.Combine(currentDirectory, assemblyName + ".dll"));
                if (!File.Exists(assemblypath)) throw new FileNotFoundException("Cannot find test assembly at " + assemblypath);
                assemblyList.Add(assemblypath);
            }

            // Get the test result path
            if (!string.IsNullOrEmpty(testResult))
            {
                testResult = testResult.Replace("$(dataFolder)", Settings.DataFolder);
                testresultpath = Path.GetFullPath(Path.Combine(currentDirectory, testResult));
            }

            // Initialize NUnit
            if (!CoreExtensions.Host.Initialized) CoreExtensions.Host.InitializeService();
            package = new TestPackage(prefix, assemblyList);
            var testSuite = new TestSuiteBuilder().Build(package);

            // Recursively load all tests
            Action<ITest> getTests = null;
            getTests = x =>
                x.Tests.Cast<ITest>().ToList().ForEach(t =>
                {
                    t.Categories.Cast<string>().ToList().ForEach(c =>
                    {
                        if (!categories.Contains(c)) categories.Add(c);
                    });

                    var item = t as NUnitTestMethod;
                    if (item != null) tests.Add(item);
                    if (t.IsSuite) getTests(t);
                });

            getTests(testSuite);
        }
开发者ID:jorgelusar,项目名称:sctestrunner,代码行数:48,代码来源:RunnerHandler.cs

示例15: 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);
        }
开发者ID:fotisp,项目名称:conqat,代码行数:19,代码来源:XmlResultVisitorTest.cs


注:本文中的NUnit.Core.TestSuiteBuilder类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。