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


C# TestSuite.Add方法代码示例

本文整理汇总了C#中TestSuite.Add方法的典型用法代码示例。如果您正苦于以下问题:C# TestSuite.Add方法的具体用法?C# TestSuite.Add怎么用?C# TestSuite.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TestSuite的用法示例。


在下文中一共展示了TestSuite.Add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuildMultipleFixtures

        private Test BuildMultipleFixtures(Type type, Attribute[] attrs)
        {
            TestSuite suite = new TestSuite(type.Namespace, TypeHelper.GetDisplayName(type));

            foreach (Attribute attr in attrs)
                suite.Add(BuildSingleFixture(type, attr));

            return suite;
        }
开发者ID:Phaiax,项目名称:dotnetautoupdate,代码行数:9,代码来源:NUnitTestFixtureBuilder.cs

示例2: GetTests

 public override ITestSuite GetTests()
 {
     TestSuite suite = new TestSuite(this.Name);
     int index = 0;
     foreach(Delegate del in Test.GetInvocationList())
     {
         string name = String.Format("Test{0}", index).TrimEnd('0');
         ITestCase tc = CreateTestCase(del, name);
         suite.Add(tc);
         index++;
     }
     return suite;
 }
开发者ID:BackupTheBerlios,项目名称:mbunit-svn,代码行数:13,代码来源:TestCaseComponent.cs

示例3: AddSetUpFixture

        private void AddSetUpFixture(TestSuite newSetupFixture, TestSuite containingSuite, string ns)
        {
            // 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)
                newSetupFixture.Add(child);

            if (containingSuite is SetUpFixture)
            {
                // The parent suite is also a SetupFixture. The new
                // SetupFixture is nested below the parent SetupFixture.
                // TODO: Avoid nesting of SetupFixtures somehow?
                //
                // Note: The tests have already been copied to the new
                //       SetupFixture. Thus the tests collection of
                //       the parent SetupFixture can be cleared.
                containingSuite.Tests.Clear();
                containingSuite.Add(newSetupFixture);
            }
            else
            {
                // 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)
                {
                    newSetupFixture.Name = rootSuite.Name;
                    rootSuite = newSetupFixture;
                }
                else
                {
                    parent.Tests.Remove(containingSuite);
                    parent.Add(newSetupFixture);
                }
            }

            // Update the dictionary
            namespaceSuites[ns] = newSetupFixture;
        }
开发者ID:JohanLarsson,项目名称:nunit,代码行数:42,代码来源:NamespaceTreeBuilder.cs

示例4: BuildTestAssembly

		private TestSuite BuildTestAssembly( string assemblyName, IList fixtures, bool autoSuites )
		{
			TestSuite testAssembly = new TestSuite( assemblyName );

			if ( autoSuites )
			{
				NamespaceTreeBuilder treeBuilder = 
					new NamespaceTreeBuilder( testAssembly );
				treeBuilder.Add( fixtures );
                testAssembly = treeBuilder.RootSuite;
			}
			else 
			foreach( TestSuite fixture in fixtures )
			{
				if ( fixture is SetUpFixture )
				{
					fixture.RunState = RunState.NotRunnable;
					fixture.IgnoreReason = "SetUpFixture cannot be used when loading tests as a flat list of fixtures";
				}

				testAssembly.Add( fixture );
			}

			if ( fixtures.Count == 0 )
			{
				testAssembly.RunState = RunState.NotRunnable;
				testAssembly.IgnoreReason = "Has no TestFixtures";
			}
			
            NUnitFramework.ApplyCommonAttributes( assembly, testAssembly );

			// TODO: Make this an option? Add Option to sort assemblies as well?
			testAssembly.Sort();

			return testAssembly;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:36,代码来源:TestAssemblyBuilder.cs

示例5: Add

        /// <summary>
        /// Adds the specified fixture to the tree.
        /// </summary>
        /// <param name="fixture">The fixture to be added.</param>
        public void Add( TestSuite fixture )
        {
            string ns = fixture.FullName;
            int index = ns.IndexOf("[");
            if (index >= 0) ns = ns.Substring(0, index);
            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.Name = rootSuite.Name;
                    rootSuite = fixture;
                }
                else
                {
                    parent.Tests.Remove(containingSuite);
                    parent.Add(fixture);
                }

                // Update the dictionary
                namespaceSuites[ns] = fixture;
            }
            else
                containingSuite.Add( fixture );
        }
开发者ID:balaghanta,项目名称:nunit-framework,代码行数:43,代码来源:NamespaceTreeBuilder.cs


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