/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/EditorFeatures/TestUtilities/RenameTracking/MockRefactorNotifyService.cs
46 строк
2 KB
David Wengier
Move IRefactorNotifyService down to features layer (#81749)
19 дек 2025, 07:57
Не верифицирован
19 дек 2025, 07:57
f009f3e
Код
Авторство
О чём код?
// 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.Collections.Generic; using System.Runtime.InteropServices; using Microsoft.CodeAnalysis.Rename; namespace Microsoft.CodeAnalysis.Editor.UnitTests.RenameTracking; public sealed class MockRefactorNotifyService : IRefactorNotifyService { private int _onAfterSymbolRenamedCount = 0; public int OnBeforeSymbolRenamedCount { get; private set; } = 0; public int OnAfterSymbolRenamedCount { get { return _onAfterSymbolRenamedCount; } } public bool OnBeforeSymbolRenamedReturnValue { get; set; } public bool OnAfterSymbolRenamedReturnValue { get; set; } public bool TryOnBeforeGlobalSymbolRenamed(Workspace workspace, IEnumerable<DocumentId> changedDocumentIDs, ISymbol symbol, string newName, bool throwOnFailure) { OnBeforeSymbolRenamedCount++; if (throwOnFailure && !OnBeforeSymbolRenamedReturnValue) { Marshal.ThrowExceptionForHR(unchecked((int)0x80004004)); // E_ABORT } return OnBeforeSymbolRenamedReturnValue; } public bool TryOnAfterGlobalSymbolRenamed(Workspace workspace, IEnumerable<DocumentId> changedDocumentIDs, ISymbol symbol, string newName, bool throwOnFailure) { _onAfterSymbolRenamedCount++; if (throwOnFailure && !OnAfterSymbolRenamedReturnValue) { Marshal.ThrowExceptionForHR(unchecked((int)0x80004004)); // E_ABORT } return OnAfterSymbolRenamedReturnValue; } }