• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TestOutcome类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: SubmitResult

        public static void SubmitResult(Uri testVaultServer, string session, string project, string buildname, string testgroup, string testname, TestOutcome outcome, bool personal)
        {
            try
            {
                using ( var client = new WebClient() ){

                    client.BaseAddress = testVaultServer.ToString();
                    client.CachePolicy = new System.Net.Cache.RequestCachePolicy( System.Net.Cache.RequestCacheLevel.NoCacheNoStore );
                    client.Headers.Add("Content-Type", "text/xml");

                    var result = new TestResult()
                    {
                        Group = new TestGroup() { Name = testgroup, Project = new TestProject() { Project = project } },
                        Name = testname,
                        Outcome = outcome,
                        TestSession = session,
                        IsPersonal = personal,
                        BuildID = buildname,
                    };

                    var xc = new XmlSerializer(result.GetType());
                    var io = new System.IO.MemoryStream();
                    xc.Serialize( io, result );

                    client.UploadData( testVaultServer.ToString(), io.ToArray() );

                }
            } catch ( Exception e )
            {
                Console.Error.WriteLine( e );
            }
        }
开发者ID:inorton,项目名称:testvault,代码行数:32,代码来源:TestVaultUtils.cs


示例2: ScenarioResult

 /// <summary>
 /// Creates a result record.
 /// </summary>
 /// <param name="method">Test method metadata object.</param>
 /// <param name="testClass">Test class metadata object.</param>
 /// <param name="result">Test result object.</param>
 /// <param name="exception">Exception instance, if any.</param>
 public ScenarioResult(ITestMethod method, ITestClass testClass, TestOutcome result, Exception exception)
 {
     TestClass = testClass;
     TestMethod = method;
     Exception = exception;
     Result = result;
 }
开发者ID:shijiaxing,项目名称:SilverlightToolkit,代码行数:14,代码来源:ScenarioResult.cs


示例3: CreateFakeRun

 private TestStepRun CreateFakeRun(string id, TestOutcome outcome, params TestStepRun[] children)
 {
     var run = new TestStepRun(new TestStepData(id, id, id, id));
     run.Result = new TestResult(outcome);
     run.Children.AddRange(children);
     return run;
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:7,代码来源:TestStepRunTreeStatisticsTest.cs


示例4: ToTestResult

 public TestResult ToTestResult(string qualifiedTestCaseName, TestOutcome outcome, int duration, string executable = DummyExecutable)
 {
     return new TestResult(ToTestCase(qualifiedTestCaseName, executable))
     {
         Outcome = outcome,
         Duration = TimeSpan.FromMilliseconds(duration)
     };
 }
开发者ID:csoltenborn,项目名称:GoogleTestAdapter,代码行数:8,代码来源:TestDataCreator.cs


示例5: TestOutcomeTotalsAreCorrect

 public int TestOutcomeTotalsAreCorrect(TestOutcome outcome)
 {
     return testLog.Events
         .FindAll(e => e.EventType == FakeFrameworkHandle.EventType.RecordResult)
         .ConvertAll(e => e.TestResult)
         .FindAll(r => r.Outcome == outcome)
         .Count;
 }
开发者ID:kukubadze,项目名称:nunit-vs-adapter,代码行数:8,代码来源:TestExecutionTests.cs


示例6: FromRelativePaths

 public static TestInfo FromRelativePaths(string className, string methodName, string projectFilePath, string sourceCodeFilePath, int sourceCodeLineNumber, TestOutcome outcome, string classFilePath = null) {
     return FromAbsolutePaths(className,
         methodName,
         TestData.GetPath(projectFilePath),
         TestData.GetPath(sourceCodeFilePath),
         sourceCodeLineNumber,
         outcome,
         classFilePath != null ? TestData.GetPath(classFilePath) : null);
 }
开发者ID:zooba,项目名称:PTVS,代码行数:9,代码来源:TestInfo.cs


示例7: Event

 void ITestExecutionRecorder.RecordEnd(TestCase testCase, TestOutcome outcome)
 {
     Events.Add(new Event()
     {
         EventType = EventType.RecordEnd,
         TestCase = testCase,
         TestOutcome = outcome
     });
 }
开发者ID:rprouse,项目名称:nunit-vs-adapter,代码行数:9,代码来源:FakeFrameworkHandle.cs


示例8: FromAbsolutePaths

 public static TestInfo FromAbsolutePaths(string className, string methodName, string projectFilePath, string sourceCodeFilePath, int sourceCodeLineNumber, TestOutcome outcome, string classFilePath = null) {
     TestInfo ti = new TestInfo();
     ti.ClassName = className;
     ti.MethodName = methodName;
     ti.ProjectFilePath = projectFilePath;
     ti.SourceCodeFilePath = sourceCodeFilePath;
     ti.SourceCodeLineNumber = sourceCodeLineNumber;
     ti.Outcome = outcome;
     ti.ClassFilePath = classFilePath ?? sourceCodeFilePath;
     ti.RelativeClassFilePath = CommonUtils.GetRelativeFilePath(Path.GetDirectoryName(ti.ProjectFilePath), ti.ClassFilePath);
     return ti;
 }
开发者ID:zooba,项目名称:PTVS,代码行数:12,代码来源:TestInfo.cs


示例9: GallioRunListener

    public GallioRunListener(ISpecificationRunListener listener, IProgressMonitor progressMonitor,
      ITestContext context, IEnumerable<ITestCommand> specificationCommands)
    {
      _listener = listener;
      _progressMonitor = progressMonitor;
      _testContext = context;

      _outcome = TestOutcome.Passed;

      _contextsBySpec = new Dictionary<string, ITestContext>();
      _commandsBySpec = (from command in specificationCommands
                         let specificationTest = command.Test as MachineSpecificationTest
                         where specificationTest != null
                         select new { Name = specificationTest.Specification.Name, Command = command })
                         .ToDictionary(x => x.Name, x => x.Command);
    }
开发者ID:agross,项目名称:machine.specifications,代码行数:16,代码来源:GallioRunListener.cs


示例10: FinishTestAsync

        public static async Task FinishTestAsync(string testName, TestOutcome outcome, string message = null, string filename = null, string stdOut = null, bool printFailuresOnly = false)
        {
            var endTime = DateTimeOffset.Now.Ticks;

            TimeSpan duration;
            long startTime;
            if (TestStartTimes.TryGetValue(testName, out startTime))
            {
                duration = new TimeSpan(endTime - startTime);
                TestStartTimes.Remove(testName);
            }
            else
            {
                duration = TimeSpan.Zero;
            }

            if (null == filename)
            {
                TestStartFilename.TryGetValue(testName, out filename);
                TestStartFilename.Remove(testName);
            }

            if (!printFailuresOnly || outcome != TestOutcome.Passed)
            {
                FancyConsole.Write("Test {0} complete.", testName);
                switch (outcome)
                {
                    case TestOutcome.Failed:
                        FancyConsole.Write(ConsoleColor.Red, " Failed: {0}", message);
                        break;
                    case TestOutcome.Passed:
                        FancyConsole.Write(ConsoleColor.Green, " Passed: {0}", message);
                        break;
                    default:
                        FancyConsole.Write(" {0}: {1}", outcome, message);
                        break;
                }
                FancyConsole.WriteLine(" duration: {0}", duration);
            }

            await BuildWorkerApi.RecordTestAsync(testName, TestFrameworkName, outcome: outcome, durationInMilliseconds: (long)duration.TotalMilliseconds, errorMessage: message, filename: filename, stdOut: stdOut);
        }
开发者ID:rgregg,项目名称:markdown-scanner,代码行数:42,代码来源:TestReport.cs


示例11: MSTestResult

        /// <summary>
        /// Initializes a new instance of the <see cref="MSTestAllureAdapter.MSTestResult"/> class.
        /// </summary>
        /// <param name="name">Name.</param>
        /// <param name="outcome">Outcome.</param>
        /// <param name="start">Start time.</param>
        /// <param name="end">End time.</param>
        /// <param name="suits">List of test suits this test belongs to.</param>
        /// <param name="innerResults">List of inner test results this test might have.</param>
        public MSTestResult(string name, TestOutcome outcome, DateTime start, DateTime end, IEnumerable<string> suits, IEnumerable<MSTestResult> innerResults) 
		{ 
            Name = name;

            mSuits = suits ?? Enumerable.Empty<string>();

            Outcome = outcome;
            Start = start;
            End = end;

            List<MSTestResult> results = new List<MSTestResult>();
            if (innerResults != null)
            {
                foreach (MSTestResult result in innerResults)
                {
                    results.Add(result.Clone());
                }
            }

            InnerTests = results;
		}
开发者ID:allure-framework,项目名称:allure-mstest-adapter,代码行数:30,代码来源:MSTestResult.cs


示例12: Terminate

 /// <summary>
 /// Terminates the test and reports a specific test outcome.
 /// </summary>
 /// <remarks>
 /// <para>
 /// The test is terminated with by throwing a <see cref="TestTerminatedException" />
 /// with the specified outcome.  If other code in the test case catches
 /// this exception and does not rethrow it then the test might not terminate correctly.
 /// </para>
 /// </remarks>
 /// <param name="outcome">The desired test outcome.</param>
 /// <param name="messageFormat">The custom message format string, or null if none.</param>
 /// <param name="messageArgs">The custom message arguments, or null if none.</param>
 /// <exception cref="TestTerminatedException">Thrown always.</exception>
 public static void Terminate(TestOutcome outcome, string messageFormat, params object[] messageArgs)
 {
     throw new TestTerminatedException(outcome, messageFormat != null && messageArgs != null
         ? String.Format(messageFormat, messageArgs)
         : messageFormat ?? "The test was terminated.");
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:20,代码来源:Assert.cs


示例13: TestResult

 /// <summary>
 /// Record a test outcome.
 /// </summary>
 /// <param name="message">The accompanying message.</param>
 /// <param name="outcome">The outcome value.</param>
 public void TestResult(string message, TestOutcome outcome)
 {
   LogMessage m = Create(LogMessageType.TestResult, message);
   DecorateTestOutcome(m, outcome);
 }
开发者ID:fstn,项目名称:WindowsPhoneApps,代码行数:10,代码来源:LogMessageWriter.cs


示例14: DecorateTestOutcome

 /// <summary>
 /// Decorate the log message object with a test outcome object.
 /// </summary>
 /// <param name="message">The log message object.</param>
 /// <param name="outcome">Test outcome object.</param>
 protected static void DecorateTestOutcome(LogMessage message, TestOutcome outcome)
 {
   Decorate(message, LogDecorator.TestOutcome, outcome);
 }
开发者ID:fstn,项目名称:WindowsPhoneApps,代码行数:9,代码来源:LogMessageWriter.cs


示例15: RecordEnd

 public void RecordEnd(TestCase testCase, TestOutcome outcome) {
 }
开发者ID:RussBaz,项目名称:PTVS,代码行数:2,代码来源:MockTestExecutionRecorder.cs


示例16: FinishStep

 /// <summary>
 /// Finishes the step represented by the context.
 /// </summary>
 /// <param name="outcome">The outcome.</param>
 /// <returns>The final test result.</returns>
 internal TestResult FinishStep(TestOutcome outcome)
 {
     return inner.FinishStep(outcome, null);
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:9,代码来源:TestContext.cs


示例17: TestTerminatedException

 /// <summary>
 /// Creates an exception.
 /// </summary>
 /// <param name="outcome">The test outcome.</param>
 /// <param name="message">The message, or null if none.</param>
 /// <param name="innerException">The inner exception, or null if none.</param>
 public TestTerminatedException(TestOutcome outcome, string message, Exception innerException)
     : base(message, innerException)
 {
     this.outcome = outcome;
 }
开发者ID:rprouse,项目名称:mbunit-v3,代码行数:11,代码来源:TestTerminatedException.cs


示例18: New_MSVST4U_UnitTestResult_DataDriven

 public static MSVST4U_UnitTestResult New_MSVST4U_UnitTestResult_DataDriven(Guid runId, ITestElement test, TestOutcome outcome, TestResultCounter counters, MSVSTTC_TestResult[] innerResults)
 {
     return MSVST4U_Tunnels.CreateAggregateDataTestResult(runId, test, outcome, counters, innerResults);
 }
开发者ID:quetzalcoatl,项目名称:xvsr10,代码行数:4,代码来源:InternalAccess1.cs


示例19: TerminateSilently

 /// <summary>
 /// Terminates the test silently and reports a specific test outcome.
 /// </summary>
 /// <remarks>
 /// <para>
 /// Unlike <see cref="Terminate(TestOutcome)" /> this method does not report the
 /// stack trace.  It also does not include a termination reason unless one is explicitly
 /// specified by the caller.
 /// </para>
 /// <para>
 /// The test is terminated with by throwing a <see cref="SilentTestException" />
 /// with the specified outcome.  If other code in the test case catches
 /// this exception and does not rethrow it then the test might not terminate correctly.
 /// </para>
 /// </remarks>
 /// <param name="outcome">The desired test outcome.</param>
 /// <exception cref="SilentTestException">Thrown always.</exception>
 public static void TerminateSilently(TestOutcome outcome)
 {
     TerminateSilently(outcome, null, null);
 }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:21,代码来源:Assert.cs


示例20: AddTestMethodResult

            /// <summary>
            /// Adds the result of a test method into the log.
            /// </summary>
            /// <param name="test">The test metadata.</param>
            /// <param name="storage">The storage value.</param>
            /// <param name="codeBase">The code base value.</param>
            /// <param name="adapterTypeName">The adapter type name.</param>
            /// <param name="className">The class name.</param>
            /// <param name="testListName">The test list name.</param>
            /// <param name="computerName">The computer name.</param>
            /// <param name="startTime">The start time.</param>
            /// <param name="endTime">The end time.</param>
            /// <param name="outcome">The outcome.</param>
            public void AddTestMethodResult(
                ITestMethod test,
                string storage,
                string codeBase,
                string adapterTypeName,
                string className,
                string testListName,
                string computerName,
                DateTime startTime,
                DateTime endTime,
                TestOutcome outcome)
            {
                if (test == null)
                {
                    throw new ArgumentNullException("test");
                }

                // Friendly name of the test
                string name = test.Name;

                // Generate GUIDs.
                string testId = Guid.NewGuid().ToString();
                string executionId = Guid.NewGuid().ToString();
                string testListId = GetTestListGuid(testListName);

                // UnitTest element.
                SimpleXElement unitTest = CreateElement("UnitTest");
                unitTest.SetAttributeValue("name", name);
                unitTest.SetAttributeValue("storage", storage);
                unitTest.SetAttributeValue("id", testId);

                SimpleXElement owners = CreateElement("Owners");
                SimpleXElement owner = CreateElement("Owner");
                string ownerString = test.Owner ?? string.Empty;
                owner.SetAttributeValue("name", ownerString);
                owners.Add(owner);
                unitTest.Add(owners);

                if (!string.IsNullOrEmpty(test.Description))
                {
                    SimpleXElement description = CreateElement("Description");
                    description.SetValue(test.Description);
                    unitTest.Add(description);
                }

                SimpleXElement execution = CreateElement("Execution");
                execution.SetAttributeValue("id", executionId);
                unitTest.Add(execution);

                // TestMethod element.
                SimpleXElement testMethod = CreateElement("TestMethod");
                testMethod.SetAttributeValue("codeBase", codeBase);
                testMethod.SetAttributeValue("adapterTypeName", adapterTypeName);
                testMethod.SetAttributeValue("className", className);
                testMethod.SetAttributeValue("name", name);
                unitTest.Add(testMethod);

                TestDefinitions.Add(unitTest);

                // TestEntry element.
                SimpleXElement testEntry = CreateElement("TestEntry");
                testEntry.SetAttributeValue("testId", testId);
                testEntry.SetAttributeValue("executionId", executionId);
                testEntry.SetAttributeValue("testListId", testListId);
                TestEntries.Add(testEntry);

                // UnitTestResult element.
                SimpleXElement unitTestResult = CreateElement("UnitTestResult");
                unitTestResult.SetAttributeValue("executionId", executionId);
                unitTestResult.SetAttributeValue("testId", testId);
                unitTestResult.SetAttributeValue("testName", name);
                unitTestResult.SetAttributeValue("computerName", computerName);

                TimeSpan duration = endTime.Subtract(startTime);
                unitTestResult.SetAttributeValue("duration", duration.ToString());

                unitTestResult.SetAttributeValue("startTime", ToDateString(startTime));
                unitTestResult.SetAttributeValue("endTime", ToDateString(endTime));
                unitTestResult.SetAttributeValue("testType", UnitTestTestTypeId);
                unitTestResult.SetAttributeValue("outcome", outcome.ToString());
                unitTestResult.SetAttributeValue("testListId", testListId.ToString());

                // Add any pending items
                foreach (SimpleXElement pending in _pendingElements)
                {
                    unitTestResult.Add(pending);
                }
//.........这里部分代码省略.........
开发者ID:shijiaxing,项目名称:SilverlightToolkit,代码行数:101,代码来源:VisualStudioLogProvider.Writer.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TestPackage类代码示例发布时间:2022-05-24
下一篇:
C# TestObject类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap