本文整理汇总了C#中UnityTest.TestResult类的典型用法代码示例。如果您正苦于以下问题:C# TestResult类的具体用法?C# TestResult怎么用?C# TestResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestResult类属于UnityTest命名空间,在下文中一共展示了TestResult类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateTestStarted
public static ResultDTO CreateTestStarted(TestResult test)
{
var dto = new ResultDTO(MessageType.TestStarted);
dto.testName = test.FullName;
dto.testTimeout = test.TestComponent.timeout;
return dto;
}
开发者ID:Bahamutho,项目名称:GJ04-ST.-STELF-EALTH,代码行数:7,代码来源:ResultDTO.cs
示例2: CreateTestFinished
public static ResultDTO CreateTestFinished(TestResult test)
{
var dto = new ResultDTO(MessageType.TestFinished);
dto.testName = test.FullName;
dto.testResult = GetSerializableTestResult(test);
return dto;
}
开发者ID:Bahamutho,项目名称:GJ04-ST.-STELF-EALTH,代码行数:7,代码来源:ResultDTO.cs
示例3: AddTest
public TestResult AddTest ()
{
var go = new GameObject ();
go.name = "New Test";
go.AddComponent<TestComponent>();
go.transform.hideFlags |= HideFlags.HideInInspector;
var testResult = new TestResult (go);
testList.Add(testResult);
SortTestList ();
return testResult;
}
开发者ID:Eji4h,项目名称:GrowingGamesGuidedByTests,代码行数:13,代码来源:TestManager.cs
示例4: AddTest
public TestResult AddTest ()
{
var go = new GameObject ();
go.name = "New Test";
go.AddComponent<TestComponent>();
ShowTestInHierarchy (go, true);
var testResult = new TestResult (go);
testList.Add(testResult);
SortTestList ();
return testResult;
}
开发者ID:eyalzur,项目名称:CodeSamplesPublic,代码行数:13,代码来源:TestManager.cs
示例5: GetSerializableTestResult
private static ITestResult GetSerializableTestResult(TestResult test)
{
var str = new SerializableTestResult();
str.resultState = test.ResultState;
str.message = test.messages;
str.executed = test.Executed;
str.name = test.Name;
str.fullName = test.FullName;
str.id = test.id;
str.isSuccess = test.IsSuccess;
str.duration = test.duration;
str.stackTrace = test.stacktrace;
return str;
}
开发者ID:Bahamutho,项目名称:GJ04-ST.-STELF-EALTH,代码行数:16,代码来源:ResultDTO.cs
示例6: GetIconForResult
public static Texture GetIconForResult ( TestResult.ResultType resultState )
{
switch (resultState)
{
case TestResult.ResultType.Success:
return Icons.successImg;
case TestResult.ResultType.Timeout:
case TestResult.ResultType.Failed:
case TestResult.ResultType.FailedException:
return Icons.failImg;
case TestResult.ResultType.Ignored:
return Icons.ignoreImg;
case TestResult.ResultType.NotRun:
default:
return Icons.unknownImg;
}
}
开发者ID:GreagDeay,项目名称:unity3d-jenkins,代码行数:17,代码来源:GuiHelper.cs
示例7: GetIconBasedOnResultType
private GUIContent GetIconBasedOnResultType (TestResult result)
{
if (result == null) return Icons.guiUnknownImg;
if (result.isRunning)
{
return Icons.GetSpinningIcon ();
}
if (result.resultType == TestResult.ResultType.NotRun
&& result.TestComponent.ignored)
return Icons.guiIgnoreImg;
switch (result.resultType)
{
case TestResult.ResultType.Success:
return Icons.guiSuccessImg;
case TestResult.ResultType.Timeout:
case TestResult.ResultType.Failed:
case TestResult.ResultType.FailedException:
return Icons.guiFailImg;
case TestResult.ResultType.Ignored:
return Icons.guiIgnoreImg;
case TestResult.ResultType.NotRun:
default:
return Icons.guiUnknownImg;
}
}
开发者ID:eyalzur,项目名称:CodeSamplesPublic,代码行数:27,代码来源:IntegrationTestRunnerRenderer.cs
示例8: RemoveTest
private void RemoveTest (TestResult test)
{
var testsToDelete = new List<TestResult> { test };
if (selectedTests.Count > 1)
testsToDelete = selectedTests;
if (EditorUtility.DisplayDialog ("",
"Are you sure you want to delete " +
((testsToDelete.Count > 1) ? (testsToDelete.Count + " tests?"):(testsToDelete.Single().name + "?")),
"Delete",
"Cancel"))
{
foreach (var t in testsToDelete)
{
#if !UNITY_4_0 && !UNITY_4_0_1 && !UNITY_4_1 && !UNITY_4_2
Undo.DestroyObjectImmediate ((t as TestResult).go);
#else
Undo.RegisterSceneUndo ("Destroy Objects");
GameObject.DestroyImmediate (t.go);
#endif
}
testManager.DeleteTest(testsToDelete);
selectedTests.Clear ();
forceRepaint = true;
}
}
开发者ID:eyalzur,项目名称:CodeSamplesPublic,代码行数:27,代码来源:IntegrationTestRunnerRenderer.cs
示例9: IntegrationTestLine
public IntegrationTestLine(GameObject gameObject, TestResult testResult)
: base(gameObject)
{
m_Result = testResult;
}
开发者ID:RichLogan,项目名称:CiscoSpark-UnitySDK,代码行数:5,代码来源:IntegrationTestLine.cs
示例10: TestStarted
public void TestStarted(TestResult test)
{
m_Window.SetCurrentTest(test.TestComponent);
m_CurrentTest = test.TestComponent;
}
开发者ID:ntl92bk,项目名称:Entitas-CSharp,代码行数:5,代码来源:IntegrationTestsRunnerWindow.cs
示例11: RemoveTest
private void RemoveTest (TestResult test)
{
var testsToDelete = new List<TestResult> { test };
if (selectedTests.Count > 1)
testsToDelete = selectedTests;
foreach (var t in testsToDelete)
{
#if UNITY_4_0 || UNITY_4_0_1 || UNITY_4_1 || UNITY_4_2
Undo.RegisterSceneUndo ("Destroy Tests");
GameObject.DestroyImmediate (t.TestComponent.gameObject);
#else
Undo.DestroyObjectImmediate (t.TestComponent.gameObject);
#endif
}
TestManager.InvalidateTestList ();
selectedTests.Clear ();
forceRepaint = true;
}
开发者ID:Eji4h,项目名称:GrowingGamesGuidedByTests,代码行数:20,代码来源:IntegrationTestRunnerRenderer.cs
示例12: FinishTest
private void FinishTest(TestResult.ResultType result)
{
m_TestsProvider.FinishTest(currentTest);
var testResult = m_ResultList.Single(t => t.GameObject == currentTest.gameObject);
testResult.resultType = result;
testResult.duration = Time.time - m_StartTime;
testResult.messages = m_TestMessages;
testResult.stacktrace = m_Stacktrace;
TestRunnerCallback.TestFinished(testResult);
currentTest = null;
if (!testResult.IsSuccess
&& testResult.Executed
&& !testResult.IsIgnored) k_ResultRenderer.AddResults(Application.loadedLevelName, testResult);
}
开发者ID:LostLT,项目名称:TestTools,代码行数:14,代码来源:TestRunner.cs
示例13: DrawTestGroup
private bool DrawTestGroup ( TestResult testInfo, int indent )
{
EditorGUILayout.BeginHorizontal ();
GUILayout.Space (--indent * 15);
EditorGUIUtility.SetIconSize (new Vector2 (15, 15));
Color tempColor = GUI.color;
if (testInfo.isRunning)
{
var frame = Mathf.Abs (Mathf.Cos (Time.realtimeSinceStartup * 4)) * 0.6f + 0.4f;
GUI.color = new Color (1, 1, 1, frame);
}
var label = new GUIContent (testInfo.Name, GetIconBasedOnResultType (testInfo).image);
var labelRect = GUILayoutUtility.GetRect (label, EditorStyles.label, GUILayout.ExpandWidth (true));
if (labelRect.Contains (Event.current.mousePosition)
&& Event.current.type == EventType.MouseDown
&& Event.current.button == 0)
{
SelectTest (testInfo);
}
else if (labelRect.Contains (Event.current.mousePosition)
&& Event.current.type == EventType.ContextClick)
{
Event.current.Use ();
DrawContextTestMenu (testInfo);
}
bool isClassFolded = foldedGroups.Contains (testInfo);
EditorGUI.BeginChangeCheck ();
isClassFolded = !EditorGUI.Foldout (labelRect, !isClassFolded, label
,selectedTests.Contains (testInfo) ? Styles.selectedTestGroupStyle : Styles.testGroupStyle
);
if (EditorGUI.EndChangeCheck ())
{
if (isClassFolded)
foldedGroups.Add (testInfo);
else
foldedGroups.Remove (testInfo);
}
if (testInfo.isRunning) GUI.color = tempColor;
EditorGUIUtility.SetIconSize (Vector2.zero);
if (testInfo.resultType == TestResult.ResultType.Timeout)
{
GUILayout.Label (guiTimeoutIcon,
GUILayout.Width (24)
);
GUILayout.FlexibleSpace ();
}
EditorGUILayout.EndHorizontal ();
return !isClassFolded;
}
开发者ID:Eji4h,项目名称:GrowingGamesGuidedByTests,代码行数:55,代码来源:IntegrationTestRunnerRenderer.cs
示例14: GetIconBasedOnResultType
private GUIContent GetIconBasedOnResultType (TestResult result)
{
if (result == null)
return Icons.guiUnknownImg;
if (result.TestComponent.IsTestGroup ())
{
var childrenResults = testManager.GetChildrenTestsResults (result.TestComponent);
if (childrenResults.Any (t => t.resultType == TestResult.ResultType.Failed
|| t.resultType == TestResult.ResultType.FailedException
|| t.resultType == TestResult.ResultType.Timeout))
result.resultType = TestResult.ResultType.Failed;
else if (childrenResults.Any (t => t.resultType == TestResult.ResultType.Success))
result.resultType = TestResult.ResultType.Success;
else if (childrenResults.All (t => t.TestComponent.ignored))
result.resultType = TestResult.ResultType.Ignored;
else
result.resultType = TestResult.ResultType.NotRun;
result.isRunning = childrenResults.Any (t => t.isRunning);
}
if (result.isRunning)
return Icons.guiUnknownImg;
if (result.resultType == TestResult.ResultType.NotRun
&& result.TestComponent.ignored)
return Icons.guiIgnoreImg;
switch (result.resultType)
{
case TestResult.ResultType.Success:
return Icons.guiSuccessImg;
case TestResult.ResultType.Timeout:
case TestResult.ResultType.Failed:
case TestResult.ResultType.FailedException:
return Icons.guiFailImg;
case TestResult.ResultType.Ignored:
return Icons.guiIgnoreImg;
case TestResult.ResultType.NotRun:
default:
return Icons.guiUnknownImg;
}
}
开发者ID:Eji4h,项目名称:GrowingGamesGuidedByTests,代码行数:44,代码来源:IntegrationTestRunnerRenderer.cs
示例15: TestFinished
public void TestFinished (TestResult test)
{
currentTestNumber++;
integrationTestRunnerWindow.renderer.UpdateResults(new List<TestResult> { test });
integrationTestRunnerWindow.Repaint();
}
开发者ID:eyalzur,项目名称:CodeSamplesPublic,代码行数:6,代码来源:IntegrationTestsRunnerWindow.cs
示例16: TestStarted
public void TestStarted (TestResult test)
{
if (integrationTestRunnerWindow.renderer.blockUIWhenRunning
&& EditorUtility.DisplayCancelableProgressBar("Integration Test Runner",
"Running " + test.go.name,
(float) currentTestNumber / testNumber))
{
integrationTestRunnerWindow.isRunning = false;
EditorApplication.isPlaying = false;
}
integrationTestRunnerWindow.renderer.UpdateResults (new List<TestResult> {test});
integrationTestRunnerWindow.Repaint();
}
开发者ID:eyalzur,项目名称:CodeSamplesPublic,代码行数:14,代码来源:IntegrationTestsRunnerWindow.cs
示例17: FinishTest
private void FinishTest(TestResult.ResultType result)
{
testsProvider.FinishTest (currentTest);
var testResult = testToRun.Single (t => t.isRunning);
testResult.resultType = result;
testResult.isRunning = false;
testResult.duration = Time.time - startTime;
testResult.messages = testMessages;
testResult.stacktrace = stacktrace;
TestRunnerCallback.TestFinished (testResult);
currentTest = null;
if (!testResult.IsSuccess
&& testResult.Executed
&& !testResult.IsIgnored) resultRenderer.AddResults (Application.loadedLevelName, testResult);
}
开发者ID:Eji4h,项目名称:GrowingGamesGuidedByTests,代码行数:15,代码来源:TestRunner.cs
示例18: SelectInHierarchy
public void SelectInHierarchy (TestResult test)
{
foreach (var t in GetAllTestsResults ())
{
if (t.GameObject == null)
{
InvalidateTestList ();
continue;
}
t.TestComponent.EnableTest (test == t);
if (t.GameObject.GetComponentsInChildren<TestComponent> (true).Any (c => c == test.TestComponent))
{
t.TestComponent.EnableTest (true);
}
}
}
开发者ID:Eji4h,项目名称:GrowingGamesGuidedByTests,代码行数:16,代码来源:TestManager.cs
示例19: GetTestsToSelect
public IEnumerable<TestResult> GetTestsToSelect (List<TestResult> selectedTests, TestResult testToSelect)
{
TestResult start = null;
TestResult end = null;
for (int i = testList.Count-1; i >=0 ; i--)
{
var testResult = testList[i];
if (start==null)
{
if (testResult == testToSelect)
start = testToSelect;
else if (selectedTests.Contains (testResult))
start = testResult;
}else if(testResult == testToSelect)
{
end = testToSelect;
break;
}
if(start!=null)
{
if (testResult == testToSelect)
end = testToSelect;
else if (selectedTests.Contains(testResult))
end = testResult;
}
}
var startIdx = testList.IndexOf (start);
var endIdx = testList.IndexOf (end);
return testList.GetRange(endIdx, startIdx-endIdx+1);
}
开发者ID:Eji4h,项目名称:GrowingGamesGuidedByTests,代码行数:32,代码来源:TestManager.cs
示例20: SelectTest
private void SelectTest (TestResult testToSelect)
{
if (!Event.current.control && !Event.current.shift)
selectedTests.Clear();
if (Event.current.control && selectedTests.Contains (testToSelect))
selectedTests.Remove (testToSelect);
else if (Event.current.shift && selectedTests.Any ())
{
var tests = testManager.GetTestsToSelect(selectedTests, testToSelect);
selectedTests.Clear ();
selectedTests.AddRange (tests);
}
else
selectedTests.Add (testToSelect);
if (!EditorApplication.isPlayingOrWillChangePlaymode && selectedTests.Count == 1)
{
var selectedTest = selectedTests.Single ();
testManager.SelectInHierarchy(selectedTest);
EditorApplication.RepaintHierarchyWindow ();
}
Selection.objects = selectedTests.Select (result => result.GameObject).ToArray ();
forceRepaint = true;
GUI.FocusControl("");
}
开发者ID:Eji4h,项目名称:GrowingGamesGuidedByTests,代码行数:24,代码来源:IntegrationTestRunnerRenderer.cs
注:本文中的UnityTest.TestResult类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论