/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Scripting/CoreTestUtilities/ObjectFormatterFixtures/MockDesktopTask.cs
52 строки
2 KB
Jared Parsons
generated move
28 сен 2020, 19:36
28 сен 2020, 19:36
1cca63b
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Diagnostics; using System.Threading.Tasks; namespace ObjectFormatterFixtures { /// <summary> /// Follows the shape of the Desktop version of <see cref="Task"/> relevant for debugger display. /// </summary> [DebuggerTypeProxy(typeof(MockTaskProxy))] [DebuggerDisplay("Id = {Id}, Status = {Status}, Method = {DebuggerDisplayMethodDescription}")] internal class MockDesktopTask { private readonly Action m_action; public MockDesktopTask(Action action) { m_action = action; } public int Id => 1234; public object AsyncState => null; public TaskCreationOptions CreationOptions => TaskCreationOptions.None; public Exception Exception => null; public TaskStatus Status => TaskStatus.Created; private string DebuggerDisplayMethodDescription => m_action.Method.ToString(); } internal class MockTaskProxy { private readonly MockDesktopTask m_task; public object AsyncState => m_task.AsyncState; public TaskCreationOptions CreationOptions => m_task.CreationOptions; public Exception Exception => m_task.Exception; public int Id => m_task.Id; public bool CancellationPending => false; public TaskStatus Status => m_task.Status; public MockTaskProxy(MockDesktopTask task) { m_task = task; } } }