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


C# ResultState类代码示例

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


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

示例1: WhenTestCaseCompletes_NodeShowsProperResult

        public void WhenTestCaseCompletes_NodeShowsProperResult(ResultState resultState, int expectedIndex)
        {
            _model.IsPackageLoaded.Returns(true);
            _model.HasTests.Returns(true);
            _view.DisplayFormat.SelectedItem.Returns("NUNIT_TREE");

            var result = resultState.Status.ToString();
            var label = resultState.Label;

            var doc = new XmlDocument();
            if (string.IsNullOrEmpty(label))
                doc.LoadXml(string.Format("<test-run id='1'><test-case id='123' result='{0}'/></test-run>", result));
            else
                doc.LoadXml(string.Format("<test-run id='1'><test-case id='123' result='{0}' label='{1}'/></test-run>", result, label));

            var testNode = new TestNode(doc.FirstChild);
            _model.Tests.Returns(testNode);

            //var treeNode = _adapter.MakeTreeNode(result);
            //_adapter.NodeIndex[suiteResult.Id] = treeNode;
            _model.TestLoaded += Raise.Event<TestEventHandler>(new TestEventArgs(TestAction.TestLoaded, testNode));
            _model.TestFinished += Raise.Event<TestEventHandler>(new TestEventArgs(TestAction.TestFinished, testNode.Children[0]));

            _view.Tree.Received().SetImageIndex(Arg.Any<TreeNode>(), expectedIndex);
        }
开发者ID:KGuetter,项目名称:nunit-gui,代码行数:25,代码来源:TreeViewPresenterTests.cs

示例2: IsRunnable

 public static void IsRunnable(Type type, string name, ResultState resultState)
 {
     Test test = TestBuilder.MakeTestCase(type, name);
     Assert.That(test.RunState, Is.EqualTo(RunState.Runnable));
     TestResult result = test.Run(NullListener.NULL, TestFilter.Empty);
     if (result.HasResults)
         result = (TestResult)result.Results[0];
     Assert.That(result.ResultState, Is.EqualTo(resultState));
 }
开发者ID:Vernathic,项目名称:ic-AutoTest.NET4CTDD,代码行数:9,代码来源:TestAssert.cs

示例3: RunTests

		public void RunTests(MethodInfo testMethod, ResultState resultState, int assertionCount)
		{
			var method = _builder.BuildFrom(testMethod);

			var result = method.Run(new NullListener(), TestFilter.Empty);

			Assert.That(result.Executed, Is.True, "Was not executed");
			Assert.That(result.ResultState, Is.EqualTo(resultState), "Wrong result state");
			Assert.That(result.AssertCount, Is.EqualTo(assertionCount), "Wrong assertion count");
		}
开发者ID:kobida,项目名称:nunitv2,代码行数:10,代码来源:NUnitAsyncTestMethodTests.cs

示例4: WhenResultIsSet_IndexReflectsResultState

        public void WhenResultIsSet_IndexReflectsResultState(ResultState resultState, int expectedIndex)
        {
            TestSuiteTreeNode node = new TestSuiteTreeNode(new TestInfo(testCase));
            TestResult result = new TestResult(testCase);

            result.SetResult(resultState, null, null);
            node.Result = result;
            Assert.AreEqual(expectedIndex, node.ImageIndex);
            Assert.AreEqual(expectedIndex, node.SelectedImageIndex);
            Assert.AreEqual(resultState.ToString(), node.StatusText);
        }
开发者ID:kobida,项目名称:nunitv2,代码行数:11,代码来源:TestSuiteTreeNodeTests.cs

示例5: VerifyResultState

 void VerifyResultState(ResultState expectedState, bool executed, bool success, bool failure, bool error, string message )
 {
     Assert.That( result.ResultState , Is.EqualTo( expectedState ) );
     Assert.That( result.Executed, Is.EqualTo( executed ) );
     Assert.That( result.IsSuccess, Is.EqualTo( success ) );
     Assert.That( result.IsFailure, Is.EqualTo( failure ) );
     Assert.That( result.IsError, Is.EqualTo( error ) );
     if ( error )
         Assert.That(result.Message, Is.EqualTo("System.Exception : " + message));
     else
         Assert.That(result.Message, Is.EqualTo(message));
 }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:12,代码来源:TestResultTests.cs

示例6: RunnerTest

        public void RunnerTest(string commandLineArguments, ResultState expectedResultValidate, ResultState expectedResultRun, ParserNotation notation)
        {
            var configuration = new CommandConfiguration();
            configuration.CommandAssemblies.Add(Assembly.GetExecutingAssembly());
            var runner = new CommandRunner(new CommandParser(notation), new CommandLookup(configuration));
            var result1 = runner.Validate(commandLineArguments);
            var result2 = runner.Run(commandLineArguments);

            // Assert
            Assert.NotNull(result1);
            Assert.NotNull(result2);
            Assert.True(result1.State == expectedResultValidate);
            Assert.True(result2.State == expectedResultRun);
            Assert.NotNull(result1.CommandInfo);
        }
开发者ID:tectil,项目名称:NCommand,代码行数:15,代码来源:CommandRunnerTest.cs

示例7: GetTestResultMessageForResultState

        string GetTestResultMessageForResultState(TestResult testResult, ResultState state, string heading)
        {
            var messageBuilder = new StringBuilder();
            for (var i = 0; i < testResult.Results.Count; i++)
            {
                var result = (TestResult) testResult.Results[i];
                if (result.ResultState == state)
                {
                    messageBuilder.AppendLine(string.Format("{0} for specification {1}", heading, i + 1));
                    messageBuilder.AppendLine(result.Message);
                }
            }

            return messageBuilder.ToString();
        }
开发者ID:AnthonyEgerton,项目名称:NSpec,代码行数:15,代码来源:NSpecTestMethod.cs

示例8: ImageResult

 private Image ImageResult(ResultState resState)
 {
     Image image = new Image();
     if (resState.Equals(ResultState.Success))
     {
         image.ImageUrl = "~/img/passed.png";
     }
     else if (resState.Equals(ResultState.Ignored))
     {
         image.ImageUrl = "~/img/Ignored.png";
     }
     else
     {
         image.ImageUrl = "~/img/failed.png";
     }
     return image;
 }
开发者ID:tonyx,项目名称:NUnitWebRunner,代码行数:17,代码来源:WebResultVisualizer.cs

示例9: CreateTestResult

        public TestResult CreateTestResult(TestType type, string fullName,
                                           ResultState state = ResultState.Success, 
                                           Func<IEnumerable<TestResult>> children = null, 
                                           string stackTrace = null, 
                                           string description = null,
                                           IList categories = null,
                                           string agentName = null)
        {
            description = description ?? RandomValuesGenerator.GetRandomValue<string>();
            agentName = agentName ?? RandomValuesGenerator.GetRandomValue<string>();
            var splitted = (fullName ?? string.Empty).Split(new[]{'.'}, StringSplitOptions.RemoveEmptyEntries);

            var childResults = children != null ? children() : new TestResult[0];
            var testResult = new TestResult(new TestInfoWrapper
                                                {
                                                    TestName = new TestName
                                                                   {
                                                                       FullName = fullName,
                                                                       Name = splitted.Length > 0 ? splitted[splitted.Length - 1] : string.Empty
                                                                   },
                                                    Categories = categories,
                                                    IsSuite = type != TestType.TestMethod,
                                                    TestCount = type == TestType.TestMethod ? 1 : RandomValuesGenerator.GetRandomValue<int>(),
                                                    TestType = type.ToString()
                                                })
                                 {
                                     AssertCount = 1,
                                     Time = RandomValuesGenerator.GetRandomValue<double>()
                                 };
            if (state != ResultState.Success)
                testResult.SetResult(state,
                                     description,
                                     stackTrace);
            else
                testResult.Success(description);

            testResult.SetAgentName(agentName);

            foreach (var childResult in childResults)
            {
                testResult.AddResult(childResult);
            }

            return testResult;
        }
开发者ID:ayezutov,项目名称:NDistribUnit,代码行数:45,代码来源:TestEntitiesGenerator.cs

示例10: Process

 public override void Process()
 {
     try
     {
         Start = String.IsNullOrEmpty(Request["start"]) ? 0 : Convert.ToInt32(Request["start"]);
         Size = String.IsNullOrEmpty(Request["size"]) ? Config.GetInt("imageManagerListSize") : Convert.ToInt32(Request["size"]);
     }
     catch (FormatException)
     {
         State = ResultState.InvalidParam;
         WriteResult();
         return;
     }
     var buildingList = new List<String>();
     try
     {
         var localPath = Server.MapPath(PathToList);
         var allFiles = Directory.GetFiles(localPath, "*", SearchOption.AllDirectories)
             .Where(x => SearchExtensions.Contains(Path.GetExtension(x).ToLower()))
             .Select(x => PathToList + x.Substring(localPath.Length).Replace("\\", "/"));
         var currentUserName = HttpContext.Current.User.Identity.Name;
         //只显示该用户自己的文件
         var userFiles = allFiles.Where(file => file.Contains(currentUserName)).ToList();
         buildingList.AddRange(userFiles);
         Total = buildingList.Count;
         FileList = buildingList.OrderBy(x => x).Skip(Start).Take(Size).ToArray();
     }
     catch (UnauthorizedAccessException)
     {
         State = ResultState.AuthorizError;
     }
     catch (DirectoryNotFoundException)
     {
         State = ResultState.PathNotFound;
     }
     catch (IOException)
     {
         State = ResultState.IOError;
     }
     finally
     {
         WriteResult();
     }
 }
开发者ID:eshengsky,项目名称:iBlog,代码行数:44,代码来源:ListFileHandler.cs

示例11: UpdateStatus

 private void UpdateStatus(ResultState result)
 {
     // Status can only get worse during a run, so we can avoid
     // unnecessary calls to Invoke by checking current status.
     var currentStatus = _progressBar.Status;
     if (currentStatus != TestProgressBarStatus.Failure)
         switch (result.Status)
         {
             case TestStatus.Failed:
                 _progressBar.Status = TestProgressBarStatus.Failure;
                 break;
             case TestStatus.Skipped:
                 if (result.Label == "Invalid")
                     _progressBar.Status = TestProgressBarStatus.Failure;
                 else if (result.Label == "Ignored" && currentStatus != TestProgressBarStatus.Warning)
                     _progressBar.Status = TestProgressBarStatus.Warning;
                 break;
         }
 }
开发者ID:KGuetter,项目名称:nunit-gui,代码行数:19,代码来源:ProgressBarPresenter.cs

示例12: MappingTest

        public void MappingTest(string commandLineArguments, ResultState expectedResult, string firstArgumentValue, ParserNotation notation)
        {
            // Setup
            var parser = new CommandParser(notation);
            var args = parser.Parse(commandLineArguments);
            var configuration = new CommandConfiguration();
            configuration.CommandAssemblies.Add(Assembly.GetExecutingAssembly());
            var lookup = new CommandLookup(configuration);
            var command = lookup.GetCommand(args.First().Key);
            Assert.NotNull(args);
            Assert.NotNull(command);

            // Test
            var target = new CommandMapper();
            var result = target.Map(args.Skip(1), command.Arguments);

            // Assert
            Assert.NotNull(result);
            Assert.True(result.State == expectedResult);
            Assert.True(firstArgumentValue == null || firstArgumentValue == result?.ResultArguments?.First().ToString());
        }
开发者ID:tectil,项目名称:NCommand,代码行数:21,代码来源:CommandMapperTest.cs

示例13: ResultStateToTestOutcome

        // Public for testing
        public static TestOutcome ResultStateToTestOutcome(ResultState resultState)
        {
            switch (resultState)
            {
                case ResultState.Cancelled:
                    return TestOutcome.None;
                case ResultState.Error:
                    return TestOutcome.Failed;
                case ResultState.Failure:
                    return TestOutcome.Failed;
                case ResultState.Ignored:
                    return TestOutcome.Skipped;
                case ResultState.Inconclusive:
                    return TestOutcome.None;
                case ResultState.NotRunnable:
                    return TestOutcome.Failed;
                case ResultState.Skipped:
                    return TestOutcome.Skipped;
                case ResultState.Success:
                    return TestOutcome.Passed;
            }

            return TestOutcome.None;
        }
开发者ID:nunit,项目名称:nunit-vs-adapter,代码行数:25,代码来源:TestConverter.cs

示例14: Result

 public Result(ResultState state, Coordinate coordinate)
     : this(state)
 {
     Coordinate = coordinate;
 }
开发者ID:jgoode,项目名称:EliteExpeditionLog,代码行数:5,代码来源:Trilateration.cs

示例15: SetResult

 /// <summary>
 /// Set the result of the test.
 /// </summary>
 /// <param name="resultState">The ResultState to use in the result</param>
 /// <param name="ex">The exception that caused this result</param>
 public void SetResult(ResultState resultState, Exception ex, FailureSite failureSite)
 {
     if (resultState == ResultState.Cancelled)
         SetResult(resultState, "Test cancelled by user", BuildStackTrace(ex));
     else if (resultState == ResultState.Error)
         SetResult( resultState, BuildMessage(ex), BuildStackTrace(ex), failureSite);
     else
         SetResult(resultState, ex.Message, ex.StackTrace, failureSite);
 }
开发者ID:julianhaslinger,项目名称:shouldly,代码行数:14,代码来源:TestResult.cs


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