本文整理汇总了C#中TestSuite类的典型用法代码示例。如果您正苦于以下问题:C# TestSuite类的具体用法?C# TestSuite怎么用?C# TestSuite使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestSuite类属于命名空间,在下文中一共展示了TestSuite类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OneTimeTearDownCommand
/// <summary>
/// Construct a OneTimeTearDownCommand
/// </summary>
/// <param name="suite">The test suite to which the command applies</param>
/// <param name="setUpTearDown">A SetUpTearDownList for use by the command</param>
public OneTimeTearDownCommand(TestSuite suite, SetUpTearDownList setUpTearDown)
: base(suite)
{
if (suite.FixtureType != null)
_tearDownMethods = Reflect.GetMethodsWithAttribute(suite.FixtureType, typeof(OneTimeTearDownAttribute), true);
_setUpTearDown = setUpTearDown;
}
开发者ID:TannerBaldus,项目名称:test_accelerator,代码行数:12,代码来源:OneTimeTearDownCommand.cs
示例2: Visit
public virtual void Visit(TestSuite testSuite)
{
foreach (TestUnit child in testSuite.Children)
{
child.Apply(this);
}
}
开发者ID:timopk,项目名称:vs-boost-unit-test-adapter,代码行数:7,代码来源:BoostTestTest.cs
示例3: AssertTestCase_TestCaseError_StackTraceIsFilledWithXml
public void AssertTestCase_TestCaseError_StackTraceIsFilledWithXml()
{
var sut = "not empty string";
var ctrStub = new Mock<Constraint>();
ctrStub.Setup(c => c.Matches(It.IsAny<object>())).Throws(new ExternalDependencyNotFoundException("Filename"));
var ctr = ctrStub.Object;
var xmlContent = "<test><system></system><assert></assert></test>";
var testSuite = new TestSuite();
try
{
testSuite.AssertTestCase(sut, ctr, xmlContent);
}
catch (CustomStackTraceErrorException ex)
{
Assert.That(ex.StackTrace, Is.EqualTo(xmlContent));
}
catch (Exception ex)
{
if (ex.InnerException==null)
Assert.Fail("The exception should have been an CustomStackTraceErrorException but was {0}.\r\n{1}", new object[] { ex.GetType().FullName, ex.StackTrace });
else
Assert.Fail("The exception should have been an CustomStackTraceErrorException but was something else. The inner exception is {0}.\r\n{1}", new object[] { ex.InnerException.GetType().FullName, ex.InnerException.StackTrace });
}
}
开发者ID:Waltervondehans,项目名称:NBi,代码行数:27,代码来源:TestSuiteTest.cs
示例4: TearDown
public async Task TearDown (TestSuite suite)
{
if (!Persistent)
await Server.Stop ();
foreach (var extension in HttpClientTestFramework.Extensions)
await extension.TearDown (suite);
}
开发者ID:RafasTavares,项目名称:mac-samples,代码行数:7,代码来源:HttpClientTestHost.cs
示例5: TestCreatingTestSuiteForTestCase
public void TestCreatingTestSuiteForTestCase()
{
var suite = new TestSuite();
suite.CreateTestSuiteFor(typeof(DummyTestCase));
Assert.AreEqual(2, suite.Tests.Count);
}
开发者ID:Sam-Serpoosh,项目名称:XUnitFramework1390-1-6,代码行数:7,代码来源:TestCaseFixture.cs
示例6: TestFailsWhenDerivedExceptionIsThrown
public void TestFailsWhenDerivedExceptionIsThrown()
{
TestSuite suite = new TestSuite(typeof(DerivedExceptionThrownClass));
TestResult result = (TestResult)suite.Run().Results[0];
Assert.That(result.ResultState, Is.EqualTo(ResultState.Failure));
Assert.That(result.Message, Is.EqualTo("Expected Exception of type <System.Exception>, but was <System.ApplicationException>"));
}
开发者ID:taoxiease,项目名称:asegrp,代码行数:7,代码来源:ExpectedExceptionTests.cs
示例7: MakeOneTimeSetUpCommand
/// <summary>
/// Gets the command to be executed before any of
/// the child tests are run.
/// </summary>
/// <returns>A TestCommand</returns>
public static TestCommand MakeOneTimeSetUpCommand(TestSuite suite, List<SetUpTearDownItem> setUpTearDown, List<TestActionItem> actions)
{
// Handle skipped tests
if (suite.RunState != RunState.Runnable && suite.RunState != RunState.Explicit)
return MakeSkipCommand(suite);
// Build the OneTimeSetUpCommand itself
TestCommand command = new OneTimeSetUpCommand(suite, setUpTearDown, actions);
// Prefix with any IApplyToContext items from attributes
IList<IApplyToContext> changes = null;
if (suite.TypeInfo != null)
changes = suite.TypeInfo.GetCustomAttributes<IApplyToContext>(true);
else if (suite.Method != null)
changes = suite.Method.GetCustomAttributes<IApplyToContext>(true);
else
{
var testAssembly = suite as TestAssembly;
if (testAssembly != null)
#if PORTABLE
changes = new List<IApplyToContext>(testAssembly.Assembly.GetAttributes<IApplyToContext>());
#else
changes = (IApplyToContext[])testAssembly.Assembly.GetCustomAttributes(typeof(IApplyToContext), true);
#endif
}
if (changes != null && changes.Count > 0)
command = new ApplyChangesToContextCommand(command, changes);
return command;
}
开发者ID:elv1s42,项目名称:nunit,代码行数:37,代码来源:CommandBuilder.cs
示例8: Suite
public static TestSuite Suite()
{
TestSuite suite = new TestSuite("Security Tests");
suite.AddTests(typeof(TestSecurityExceptions));
suite.AddTests(typeof(TestSecurityElement));
return suite;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:SuiteSecurity.cs
示例9: Start
/**
* Initialize class resources.
*/
void Start()
{
// Create test suite
TestSuite suite = new TestSuite();
// For each assembly in this app domain
foreach (Assembly assem in AppDomain.CurrentDomain.GetAssemblies())
{
// For each type in the assembly
foreach (Type type in assem.GetTypes())
{
// If this is a valid test case
// i.e. derived from TestCase and instantiable
if (typeof(TestCase).IsAssignableFrom(type) &&
type != typeof(TestCase) &&
!type.IsAbstract)
{
// Add tests to suite
suite.AddAll(type.GetConstructor(new Type[0]).Invoke(new object[0]) as TestCase);
}
}
}
// Run the tests
TestResult res = suite.Run(null);
// Report results
Unity3D_TestReporter reporter = new Unity3D_TestReporter();
reporter.LogResults(res);
}
开发者ID:nadrarar,项目名称:SpaceBattleGame_source,代码行数:33,代码来源:Unity3D_TestRunner.cs
示例10: MakeOneTimeSetUpCommand
/// <summary>
/// Gets the command to be executed before any of
/// the child tests are run.
/// </summary>
/// <returns>A TestCommand</returns>
public static TestCommand MakeOneTimeSetUpCommand(TestSuite suite, List<SetUpTearDownItem> setUpTearDown, List<TestActionItem> actions)
{
// Handle skipped tests
if (suite.RunState != RunState.Runnable && suite.RunState != RunState.Explicit)
return MakeSkipCommand(suite);
// Build the OneTimeSetUpCommand itself
TestCommand command = new OneTimeSetUpCommand(suite, setUpTearDown, actions);
// Prefix with any IApplyToContext items from attributes
if (suite.TypeInfo != null)
{
IApplyToContext[] changes = suite.TypeInfo.GetCustomAttributes<IApplyToContext>(true);
if (changes.Length > 0)
command = new ApplyChangesToContextCommand(command, changes);
}
if (suite.Method!=null)
{
IApplyToContext[] changes = suite.Method.GetCustomAttributes<IApplyToContext>(true);
if (changes.Length > 0)
command = new ApplyChangesToContextCommand(command, changes);
}
return command;
}
开发者ID:rbenhassine2,项目名称:nunit,代码行数:30,代码来源:CommandBuilder.cs
示例11: Suite
public static TestSuite Suite()
{
TestSuite suite = new TestSuite("Core Class Tests");
#if CONFIG_FRAMEWORK_2_0
suite.AddTests(typeof(TestActivationArguments));
suite.AddTests(typeof(TestActivationContext));
suite.AddTests(typeof(TestApplicationId));
suite.AddTests(typeof(TestApplicationIdentity));
#endif
suite.AddTests(typeof(TestArgIterator));
suite.AddTests(typeof(TestArray));
suite.AddTests(typeof(TestAttribute));
suite.AddTests(typeof(TestBoolean));
suite.AddTests(typeof(TestConvert));
suite.AddTests(typeof(TestDecimal));
suite.AddTests(typeof(TestDelegate));
suite.AddTests(typeof(TestDouble));
suite.AddTests(typeof(TestSByte));
suite.AddTests(typeof(TestString));
#if !ECMA_COMPAT
suite.AddTests(typeof(TestGuid));
#endif
suite.AddTests(typeof(TestSystemExceptions));
suite.AddTests(typeof(TestVersion));
return suite;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:26,代码来源:SuiteSystem.cs
示例12: AddChildToTestCase
public void AddChildToTestCase()
{
TestSuite master = new TestSuite("master", null);
TestCase test = new TestCase("test", master);
test.AddChild(new TestCase());
}
开发者ID:ETAS-Eder,项目名称:vs-boost-unit-test-adapter,代码行数:7,代码来源:BoostTestTest.cs
示例13: BenchmarkStringJoin
private static void BenchmarkStringJoin(string[] testData, string expectedData)
{
var testName = String.Format("Joining strings - with {0} string", testData.Length);
// Create a TestSuite class for a group of BenchmarTests
var benchmarkSuite = new TestSuite<string[], string>(testName)
// You don't have to specify a method group - but you'll probably want to give an explicit name if you use
.Plus(input => String.Join(" ", input), "String.Join")
.Plus(LoopingWithStringBuilderCommumUsage)
.Plus(input => LoopingWithStringBuilderWithInitialCapacity(input, expectedData.Length + 2), "LoopingWithStringBuilderWithInitialCapacity")
.Plus(LoopingWithStringBuilderWithInitialValue)
.Plus(input => LoopingWithStringBuilderWithInitialValueAndCapacity(input, expectedData.Length + 2), "LoopingWithStringBuilderWithInitialValueAndCapacity")
.Plus(LoopingWithStringConcatenation)
.Plus(LoopingWithStringConcat)
.Plus(LoopingWithStringFormat);
// This returns a ResultSuite
var resultsSmallData = benchmarkSuite.RunTests(testData, expectedData)
// Again, scaling returns a new ResultSuite, with all the results scaled
// - in this case they'll all have the same number of iterations
.ScaleByBest(ScalingMode.VaryDuration);
// There are pairs for name and score, iterations or duration - but we want name, duration *and* score
resultsSmallData.Display(ResultColumns.NameAndDuration | ResultColumns.Score,
// Scale the scores to make the best one get 1.0
resultsSmallData.FindBest());
}
开发者ID:rafaelsc,项目名称:minibench,代码行数:27,代码来源:Program.cs
示例14: OneTimeSetUpCommand
/// <summary>
/// Constructs a OneTimeSetUpComand for a suite
/// </summary>
/// <param name="suite">The suite to which the command applies</param>
public OneTimeSetUpCommand(TestSuite suite)
: base(suite)
{
this.suite = suite;
this.fixtureType = suite.FixtureType;
this.arguments = suite.arguments;
}
开发者ID:yudhitech,项目名称:xamarin-android,代码行数:11,代码来源:OneTimeSetUpCommand.cs
示例15: AssertTestCase_TestCaseError_MessageIsAvailable
public void AssertTestCase_TestCaseError_MessageIsAvailable()
{
var sut = "not empty string";
var ctrStub = new Mock<Constraint>();
ctrStub.Setup(c => c.Matches(It.IsAny<object>())).Throws(new ExternalDependencyNotFoundException("Filename"));
var ctr = ctrStub.Object;
var xmlContent = "<test><system></system><assert></assert></test>";
var testSuite = new TestSuite();
try
{
testSuite.AssertTestCase(sut, ctr, xmlContent);
}
catch (CustomStackTraceErrorException ex)
{
Console.WriteLine(ex.Message);
Assert.That(ex.Message, Is.StringContaining("Filename"));
}
catch (Exception ex)
{
Assert.Fail("The exception should have been a CustomStackTraceErrorException but was {0}.", new object[] { ex.GetType().FullName });
}
}
开发者ID:zyh329,项目名称:nbi,代码行数:25,代码来源:TestSuiteTest.cs
示例16: suite
public static TestSuite suite()
{
TestSuite suite = new TestSuite();
suite.AddTestSuite(typeof(IdentityTest));
suite.AddTestSuite(typeof(AllTest));
suite.AddTestSuite(typeof(FailTest));
suite.AddTestSuite(typeof(OneTest));
suite.AddTestSuite(typeof(FailAtNodesTest));
suite.AddTestSuite(typeof(SomeTest));
suite.AddTestSuite(typeof(TopDownUntilTest));
suite.AddTestSuite(typeof(SpineBottomUpTest));
suite.AddTestSuite(typeof(SpineTopDownTest));
suite.AddTestSuite(typeof(SuccessCounterTest));
suite.AddTestSuite(typeof(IfThenElseTest));
suite.AddTestSuite(typeof(AllSpinesBottomUpTest));
suite.AddTestSuite(typeof(ChildTest));
suite.AddTestSuite(typeof(CollectTest));
suite.AddTestSuite(typeof(DescendantTest));
suite.AddTestSuite(typeof(DoWhileSuccessTest));
suite.AddTestSuite(typeof(LoggerTest));
suite.AddTestSuite(typeof(NestingDepthTest));
suite.AddTestSuite(typeof(OnceTopDownTest));
suite.AddTestSuite(typeof(TimeLogVisitorTest));
suite.AddTestSuite(typeof(LibraryTest));
return suite;
}
开发者ID:cwi-swat,项目名称:jjtraveler-csharp,代码行数:27,代码来源:TestAll.cs
示例17: OnCreate
protected override void OnCreate (Bundle bundle)
{
base.OnCreate (bundle);
test_suite = Intent.GetStringExtra ("TestSuite");
suite = AndroidRunner.Suites [test_suite];
var menu = new RootElement (String.Empty);
main = new Section (test_suite);
foreach (ITest test in suite.Tests) {
TestSuite ts = test as TestSuite;
if (ts != null)
main.Add (new TestSuiteElement (ts));
else
main.Add (new TestCaseElement (test as NUnit.Framework.Internal.Test));
}
menu.Add (main);
Section options = new Section () {
new ActionElement ("Run all", Run),
};
menu.Add (options);
var da = new DialogAdapter (this, menu);
var lv = new ListView (this) {
Adapter = da
};
SetContentView (lv);
}
开发者ID:pjcollins,项目名称:Andr.Unit,代码行数:30,代码来源:TestSuiteActivity.cs
示例18: Build
void Build (TestSuite suite)
{
// if (Environment.GetEnvironmentVariables().Contains("START_DEBUG"))
// System.Diagnostics.Debugger.Launch ();
ReadLists ();
XmlDocument whole = new XmlDocument ();
whole.Load (@"testsuite/TESTS/catalog-fixed.xml");
foreach (XmlElement testCase in whole.SelectNodes ("test-suite/test-catalog/test-case")) {
string testid = testCase.GetAttribute ("id");
if (skipTargets.Contains (testid))
continue;
CatalogTestCase ctc = new CatalogTestCase(EnvOptions.OutputDir, testCase);
if (!ctc.Process ())
continue;
SingleTestTransform stt = new SingleTestTransform (ctc);
string expectedException = (string) expectedExceptions[testid];
bool isKnownFailure = knownFailures.Contains (testid) || fixmeList.Contains (testid);
suite.Add (new TestFromCatalog (testid, stt, expectedException,
EnvOptions.InverseResults, isKnownFailure));
}
}
开发者ID:nobled,项目名称:mono,代码行数:27,代码来源:xslttest.cs
示例19: Suite
public static TestSuite Suite()
{
TestSuite suite = new TestSuite("Collection Tests");
suite.AddTests(typeof(TestArrayList));
suite.AddTests(typeof(TestHashTable));
return suite;
}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:7,代码来源:SuiteCollections.cs
示例20: TestSuiteElement
public TestSuiteElement (TestSuite suite, AndroidRunner runner) : base (suite, runner)
{
if (Suite.TestCaseCount > 0)
Indicator = ">"; // hint there's more
Caption = suite.FullName;
}
开发者ID:couchbaselabs,项目名称:Andr.Unit,代码行数:7,代码来源:TestSuiteElement.cs
注:本文中的TestSuite类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论