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


C# Commands.TestCommand类代码示例

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


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

示例1: SetUpTearDownCommand

        /// <summary>
        /// Initializes a new instance of the <see cref="SetUpTearDownCommand"/> class.
        /// </summary>
        /// <param name="innerCommand">The inner command.</param>
        public SetUpTearDownCommand(TestCommand innerCommand)
            : base(innerCommand)
        {
            Guard.ArgumentValid(innerCommand.Test is TestMethod, "SetUpTearDownCommand may only apply to a TestMethod", "innerCommand");
            Guard.OperationValid(Test.TypeInfo != null, "TestMethod must have a non-null TypeInfo");

            _setUpTearDownItems = CommandBuilder.BuildSetUpTearDownList(Test.TypeInfo.Type, typeof(SetUpAttribute), typeof(TearDownAttribute));
        }
开发者ID:textmetal,项目名称:main,代码行数:12,代码来源:SetUpTearDownCommand.cs

示例2: WorkItem

 /// <summary>
 /// Construct a WorkItem for a particular test.
 /// </summary>
 /// <param name="test">The test that the WorkItem will run</param>
 /// <param name="context">The context to be used for running this test</param>
 public WorkItem(Test test, TestExecutionContext context)
 {
     _test = test;
     _context = context.Save();
     testResult = test.MakeTestResult();
     _command = test.GetTestCommand();
     _state = WorkItemState.Ready;
 }
开发者ID:pjcollins,项目名称:Andr.Unit,代码行数:13,代码来源:WorkItem.cs

示例3: Execute

        /// <summary>
        /// Runs a TestCommand, sending notifications to a listener.
        /// </summary>
        /// <param name="command">A TestCommand to be executed.</param>
        /// <param name="context">The context in which to execute the command.</param>
        /// <returns>A TestResult.</returns>
        public static TestResult Execute(TestCommand command)
        {
            TestResult testResult;

            TestExecutionContext.Save();
            TestExecutionContext context = TestExecutionContext.CurrentContext;
            //context = new TestExecutionContext(context);

            context.CurrentTest = command.Test;
            context.CurrentResult = command.Test.MakeTestResult();

            context.Listener.TestStarted(command.Test);
            long startTime = DateTime.Now.Ticks;

            try
            {
                TestSuiteCommand suiteCommand = command as TestSuiteCommand;
                if (suiteCommand != null)
                    testResult = ExecuteSuiteCommand(suiteCommand, context);
                //{
                //    suiteCommand.DoOneTimeSetup();
                //    foreach (TestCommand childCommand in suiteCommand.Children)
                //        Execute(childCommand, context);
                //    suiteCommand.DoOneTimeTearDown();
                //}
                else
                    testResult = command.Execute(context);

                testResult.AssertCount = context.AssertCount;

                long stopTime = DateTime.Now.Ticks;
                double time = ((double)(stopTime - startTime)) / (double)TimeSpan.TicksPerSecond;
                testResult.Time = time;

                context.Listener.TestFinished(testResult);
            }
            catch (Exception ex)
            {
#if !NETCF
                if (ex is ThreadAbortException)
                    Thread.ResetAbort();
#endif
                context.CurrentResult.RecordException(ex);
                return context.CurrentResult;
            }
            finally
            {
                TestExecutionContext.Restore();
                //context.ReverseChanges();
                //context = context.prior;
            }

            return testResult;
        }
开发者ID:minhhh,项目名称:nunit-unity3d,代码行数:60,代码来源:CommandRunner.cs

示例4: ApplyChangesToContextCommand

 public ApplyChangesToContextCommand(TestCommand innerCommand, IEnumerable<IApplyToContext> changes)
     : base(innerCommand)
 {
     _changes = changes;
 }
开发者ID:textmetal,项目名称:main,代码行数:5,代码来源:ApplyChangesToContextCommand.cs

示例5: SimpleWorkItem

 /// <summary>
 /// Construct a simple work item for a test.
 /// </summary>
 /// <param name="test">The test to be executed</param>
 public SimpleWorkItem(TestMethod test, FinallyDelegate fd) : base(test, fd)
 {
     _command = test.MakeTestCommand();
 }
开发者ID:alexanderkyte,项目名称:NUnitLite,代码行数:8,代码来源:SimpleWorkItem.cs

示例6: SetUpTearDownCommand

 TestCommand ICommandDecorator.Decorate(TestCommand command)
 {
     return new SetUpTearDownCommand(command);
 }
开发者ID:haf,项目名称:nunit-framework,代码行数:4,代码来源:SetUpTearDownCommand.cs

示例7: ApplyDecoratorsToCommand

        private TestCommand ApplyDecoratorsToCommand(TestCommand command)
        {
            CommandDecoratorList decorators = new CommandDecoratorList();

            // Add Standard stuff
            decorators.Add(new SetUpTearDownDecorator());

            // Add Decorators supplied by attributes
            foreach (ICommandDecoratorSource source in Method.GetCustomAttributes(typeof(ICommandDecoratorSource), true))
                foreach (ICommandDecorator decorator in source.GetDecorators())
                    decorators.Add(decorator);

            // Add Decorators from the parameter set
            if (parms != null)
                foreach (ICommandDecorator decorator in parms.GetDecorators())
                    decorators.Add(decorator);

            decorators.OrderByStage();

            foreach (ICommandDecorator decorator in decorators)
            {
                command = decorator.Decorate(command);
            }

            return command;
        }
开发者ID:balaghanta,项目名称:nunit-framework,代码行数:26,代码来源:TestMethod.cs

示例8: MaxTimeCommand

 /// <summary>
 /// Initializes a new instance of the <see cref="MaxTimeCommand"/> class.
 /// TODO: Add a comment about where the max time is retrieved.
 /// </summary>
 /// <param name="innerCommand">The inner command.</param>
 public MaxTimeCommand(TestCommand innerCommand)
     : base(innerCommand)
 {
     this.maxTime = Test.Properties.GetSetting(PropertyNames.MaxTime, 0);
 }
开发者ID:gezidan,项目名称:ZYSOCKET,代码行数:10,代码来源:MaxTimeCommand.cs

示例9: TestActionCommand

 /// <summary>
 /// Initializes a new instance of the <see cref="TestActionCommand"/> class.
 /// </summary>
 /// <param name="innerCommand">The inner command.</param>
 public TestActionCommand(TestCommand innerCommand)
     : base(innerCommand)
 {
     Guard.ArgumentValid(innerCommand.Test is TestMethod, "TestActionCommand may only apply to a TestMethod", "innerCommand");
 }
开发者ID:alfeg,项目名称:nunit,代码行数:9,代码来源:TestActionCommand.cs

示例10: SimpleWorkItem

 /// <summary>
 /// Construct a simple work item for a test.
 /// </summary>
 /// <param name="test">The test to be executed</param>
 /// <param name="context">The execution context to be used</param>
 public SimpleWorkItem(TestMethod test, TestExecutionContext context) : base(test, context) 
 {
     _command = test.MakeTestCommand();
 }
开发者ID:haf,项目名称:nunit-framework,代码行数:9,代码来源:SimpleWorkItem.cs

示例11: MaxTimeCommand

 TestCommand ICommandDecorator.Decorate(TestCommand command)
 {
     return new MaxTimeCommand(command);
 }
开发者ID:gezidan,项目名称:ZYSOCKET,代码行数:4,代码来源:MaxTimeAttribute.cs

示例12: RepeatedTestCommand

 TestCommand ICommandDecorator.Decorate(TestCommand command)
 {
     return new RepeatedTestCommand(command);
 }
开发者ID:minhhh,项目名称:nunit-unity3d,代码行数:4,代码来源:RepeatAttribute.cs

示例13: GetTestCommand

        /// <summary>
        /// Gets a test command to be used in executing this test
        /// </summary>
        /// <param name="filter"></param>
        /// <returns></returns>
        public TestCommand GetTestCommand(ITestFilter filter)
        {
            if (testCommand == null)
                testCommand = runState != RunState.Runnable && runState != RunState.Explicit
                    ? new SkipCommand(this)
                    : MakeTestCommand(filter);

            return testCommand;
        }
开发者ID:ChadBurggraf,项目名称:NUnitLite,代码行数:14,代码来源:Test.cs

示例14: SimpleWorkItem

 /// <summary>
 /// Construct a simple work item for a test command.
 /// </summary>
 /// <param name="command">The command to be executed</param>
 public SimpleWorkItem(TestCommand command) : base(command.Test)
 {
     _command = command;
 }
开发者ID:kentcb,项目名称:nunitlite,代码行数:8,代码来源:SimpleWorkItem.cs

示例15: TheoryResultCommand

 /// <summary>
 /// Constructs a TheoryResultCommand 
 /// </summary>
 /// <param name="command">The command to be wrapped by this one</param>
 public TheoryResultCommand(TestCommand command) : base(command) { }
开发者ID:kentcb,项目名称:nunitlite,代码行数:5,代码来源:TheoryResultCommand.cs


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