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


C# TestResult类代码示例

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


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

示例1: BuildTitle

        private string BuildTitle(TestResult successful)
        {
            var sb = new StringBuilder();

            switch (successful)
            {
                default:
                case TestResult.Inconclusive:
                    sb.AppendFormat("{0}", "Inconclusive");
                    break;
                case TestResult.Passed:
                    sb.AppendFormat("{0}", "Successful");
                    break;
                case TestResult.Failed:
                    sb.AppendFormat("{0}", "Failed");
                    break;
            }

            if (!string.IsNullOrEmpty(this.configuration.SystemUnderTestName) &&
                !string.IsNullOrEmpty(this.configuration.SystemUnderTestVersion))
            {
                sb.AppendFormat(" with {0} version {1}", this.configuration.SystemUnderTestName, this.configuration.SystemUnderTestVersion);
            }
            else if (!string.IsNullOrEmpty(this.configuration.SystemUnderTestName))
            {
                sb.AppendFormat(" with {0}", this.configuration.SystemUnderTestName);
            }
            else if (!string.IsNullOrEmpty(this.configuration.SystemUnderTestVersion))
            {
                sb.AppendFormat(" with version {0}", this.configuration.SystemUnderTestVersion);
            }

            return sb.ToString();
        }
开发者ID:picklesdoc,项目名称:pickles,代码行数:34,代码来源:HtmlImageResultFormatter.cs

示例2: RunTest

        private static TestResult RunTest(object instance, MethodBase method)
        {
            var result = new TestResult { Name = method.Name };

            var sw = new Stopwatch();
            sw.Start();
            try
            {
                method.Invoke(instance, null);
                result.WasSuccessful = true;
            }
            catch (Exception ex)
            {
                result.WasSuccessful = false;
                result.Message = ex.ToString();
            }
            finally
            {
                sw.Stop();

                result.Duration = sw.ElapsedMilliseconds;
            }

            return result;
        }
开发者ID:hbidadi,项目名称:UnitTestsForDiagnosticsEndpoints,代码行数:25,代码来源:DiagnosticsController.cs

示例3: Init

		public void Init()
		{
			base.InitBase();
			
			project = new MockCSharpProject();
			MockBuildProjectBeforeTestRun buildProject = new MockBuildProjectBeforeTestRun();
			context.MockBuildProjectFactory.AddBuildProjectBeforeTestRun(buildProject);
			
			classToTest = MockClass.CreateMockClassWithoutAnyAttributes();
			classToTest.SetDotNetName("MyTestClass");
			
			treeView = new MockTestTreeView();
			treeView.SelectedProject = project;
			treeView.SelectedClass = classToTest;
			
			runTestCommand.Owner = treeView;
			
			runTestCommand.Run();
			
			buildProject.FireBuildCompleteEvent();
			
			TestResult result = new TestResult("MyTestClass");
			result.ResultType = TestResultType.Success;
			context.MockTestResultsMonitor.FireTestFinishedEvent(result);
			
			runTestCommand.CallTestsCompleted();
		}
开发者ID:hefnerliu,项目名称:SharpDevelop,代码行数:27,代码来源:RunTestsForClassTestFixture.cs

示例4: TestPacketTimeouts

        public void TestPacketTimeouts()
        {
            try
            {
                BrainCloudClient.Get().Initialize(_serverUrl + "unitTestFail", _secret, _appId, _version);
                BrainCloudClient.Get ().EnableLogging(true);
                BrainCloudClient.Get ().SetPacketTimeouts(new List<int> {3, 3, 3});

                DateTime timeStart = DateTime.Now;
                TestResult tr = new TestResult();
                tr.SetTimeToWaitSecs(120);
                BrainCloudClient.Get().AuthenticationService.AuthenticateUniversal("abc", "abc", true, tr.ApiSuccess, tr.ApiError);
                tr.RunExpectFail(StatusCodes.CLIENT_NETWORK_ERROR, ReasonCodes.CLIENT_NETWORK_ERROR_TIMEOUT);

                DateTime timeEnd = DateTime.Now;
                TimeSpan delta = timeEnd.Subtract(timeStart);
                if (delta < TimeSpan.FromSeconds (8) && delta > TimeSpan.FromSeconds(15))
                {
                    Console.WriteLine("Failed timing check - took " + delta.TotalSeconds + " seconds");
                    Assert.Fail ();
                }

            }
            finally
            {
                // reset to defaults
                BrainCloudClient.Get ().SetPacketTimeoutsToDefault();
            }
        }
开发者ID:PointlessReboot,项目名称:Unity-Csharp,代码行数:29,代码来源:TestComms.cs

示例5: TestFinished

 public void TestFinished(TestResult result)
 {
     _testRunInfo.Running = false;
     _testRunInfo.Passed = result.IsSuccess;
     _testRunInfo.TestResult = result;
     RunOnUiThread(() => _detailsView.Description = DefaultDescription);
 }
开发者ID:skela,项目名称:NUnitLite.MonoDroid,代码行数:7,代码来源:TestRunDetailsActivity.cs

示例6: 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

示例7: TestStarted

		public void TestStarted (TestResult test)
		{
			foreach (var unitTestRunnerCallback in callbackList)
			{
				unitTestRunnerCallback.TestStarted(test);
			}
		}
开发者ID:Barabicus,项目名称:RTSCameraProject,代码行数:7,代码来源:TestRunnerCallbackList.cs

示例8: EndTest

 public void EndTest(string testId, TestResult testResult)
 {
     foreach (ILogger logger in Loggers)
     {
         logger.EndTest(testId, testResult);
     }
 }
开发者ID:johnkors,项目名称:azure-sdk-tools,代码行数:7,代码来源:TestLogger.cs

示例9: AddTestResult

 public void AddTestResult(TestResult result)
 {
     if (result.stateFlag.Equals(TestResultObject.STATE_FLAG_SEVERE)) {
         isSevere = true;
     }
     testResults.Add(result);
 }
开发者ID:edwinv710,项目名称:TalkingHead,代码行数:7,代码来源:TestResultObject.cs

示例10: PrintSingleTest

        public static void PrintSingleTest()
        {
            var directories = GetBuildDirectories();

            var tests = new List<TestResult>();

            foreach (var dir in directories)
            {
                var files = Directory.GetFiles(dir, "junitResult.xml");
                if (files.Any())
                {
                    var fileName = files[0];
                    var iterator = GetTestCasesWithErrors("UserAcceptanceTests.Features.ProductFeature","RefreshOnProductAfterAddingCommentShouldNOTResultInErrorBugFix",fileName);

                    while (iterator.MoveNext())
                    {
                        var failingTest = GetFailingTestName(iterator);

                        var testResult = new TestResult {BuildName = GetBuildName(dir),TestName = failingTest};

                        tests.Add(testResult);
                    }
                }

            }
            foreach (var failingTest in tests.ToList().OrderBy(x=>x.BuildName).Reverse())
            {
                Console.WriteLine(failingTest);
            }
        }
开发者ID:asynchrony,项目名称:build-results,代码行数:30,代码来源:PrintCommonFailures.cs

示例11: EWMTestMapping

        public void EWMTestMapping()
        {
            var testResult = new TestResult()
            {
                TestID = 1,
                ProdName = "Thomson Reuters Eikon for Wealth Management",
                ProdVers = "1",
                TestCases = new List<TestCase>()
            };

            testResult.TestCases.Add(new TestCase()
            {
                ID = "1",
                Title = "Browser Version:"
            });

            testResult.TestCases.Add(new TestCase()
            {
                ID = "2",
                Title = "Operating System:"
            });

            var list = new List<TestResult> {testResult};

            DataMapper.MapStatCodeEWM(testResult);
            Assert.IsNotNull(testResult);
        }
开发者ID:montakan29,项目名称:TestGit,代码行数:27,代码来源:UnitTestEWMTestMapping.cs

示例12: AddTestResult

        public void AddTestResult(ContentFile contentFile, TestResult testResult)
        {
            var checksum = contentFile.Checksum;
            var storagePath = Path.Combine(_storagePath, checksum);
            try
            {
                if (!FileUtil.EnsureDirectory(storagePath))
                {
                    return;
                }

                Write(checksum, StorageKind.ExitCode, testResult.ExitCode.ToString());
                Write(checksum, StorageKind.AssemblyPath, testResult.AssemblyPath);
                Write(checksum, StorageKind.StandardOutput, testResult.StandardOutput);
                Write(checksum, StorageKind.ErrorOutput, testResult.ErrorOutput);
                Write(checksum, StorageKind.CommandLine, testResult.CommandLine);
                Write(checksum, StorageKind.Content, contentFile.Content);

                if (!string.IsNullOrEmpty(testResult.ResultsFilePath))
                {
                    File.Copy(testResult.ResultsFilePath, GetStoragePath(checksum, StorageKind.ResultsFile));
                }
            }
            catch (Exception e)
            {
                // I/O errors are expected and okay here.
                Logger.Log($"Failed to log {checksum} {e.Message}");
                FileUtil.DeleteDirectory(storagePath);
            }
        }
开发者ID:SoumikMukherjeeDOTNET,项目名称:roslyn,代码行数:30,代码来源:LocalDataStorage.cs

示例13: ProcessRecordThrowsExpectedExceptionSuccess

        public void ProcessRecordThrowsExpectedExceptionSuccess()
        {
            // Arrange.
            var test = new Test(
                "t",
                ScriptBlock.Create(string.Empty),
                typeof(ArgumentNullException)
            );
            var testResult = new TestResult("tr", true);

            var runtime = MockRepository.GenerateStrictMock<ICommandRuntime>();
            runtime.Expect(r => r.WriteObject(testResult));

            var cmdlet = MockRepository
                .GeneratePartialMock<TestableInvokeTestCmdlet>();
            cmdlet.Test = new[] { test };
            cmdlet.CommandRuntime = runtime;
            cmdlet
                .Expect(c => c.InvokeScriptBlock(test.TestScript))
                .Throw(new Exception("", new ArgumentNullException()));
            cmdlet
                .Expect(c => c.CreateTestResult(test.Name, true))
                .Return(testResult);

            // Act.
            cmdlet.DoProcessRecord();

            // Assert.
            cmdlet.VerifyAllExpectations();
            runtime.VerifyAllExpectations();
        }
开发者ID:joshedler,项目名称:pstest,代码行数:31,代码来源:InvokeTestCmdletTests.cs

示例14: Visit

        private void Visit(TestResult result)
        {
            if (result.Test is TestSuite)
            {
                if (result.Results != null)
                    foreach (TestResult r in result.Results)
                        Visit(r);
                return;
            }
 
            // We only count non-suites
            testCount++;
            switch (result.ResultState)
            {
                case ResultState.NotRun:
                    notRunCount++;
                    break;
                case ResultState.Error:
                    errorCount++;
                    break;
                case ResultState.Failure:
                    failureCount++;
                    break;
                default:
                    break;
            }
        }
开发者ID:RecursosOnline,项目名称:c-sharp,代码行数:27,代码来源:ResultSummary.cs

示例15: GenerateSpecificationResult

        private static SpecificationResult GenerateSpecificationResult(IAmSpecification instance)
        {
            instance.Setup();
            var specificationResult = new SpecificationResult()
            {
                Given = instance.GetGiven().ToString(),
                When = instance.When().ToString(),
                Results = new List<TestResult>()
            };

            var tests =
                instance.GetType().GetMethods().Where(
                    y => y.GetCustomAttribute<TestAttribute>() != null);
            foreach (var test in tests)
            {
                var testResult = new TestResult() { Description = test.Name.Replace("_", " "), Passed = true };
                try
                {
                    test.Invoke(instance, null);
                }
                catch (Exception)
                {
                    testResult.Passed = false;
                }
                specificationResult.Results.Add(testResult);
            }
            return specificationResult;
        }
开发者ID:mastoj,项目名称:NDCTest,代码行数:28,代码来源:TestRunner.cs


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