當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。