/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Workspaces/CoreTest/FunctionIdTests.cs
29 строк
926 B
Jason Malinowski
Switch code that was using Assert.True/False as a replacement for .Fail
21 апр 2026, 23:28
21 апр 2026, 23:28
3bf59ba
Код
Авторство
О чём код?
// 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. using System; using System.Collections.Generic; using Microsoft.CodeAnalysis.Internal.Log; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests; public sealed class FunctionIdTests { [Fact] public void NoDuplicateValues() { var map = new Dictionary<FunctionId, string>(); foreach (var name in Enum.GetNames(typeof(FunctionId))) { var value = (FunctionId)Enum.Parse(typeof(FunctionId), name); if (map.TryGetValue(value, out var existingName)) { Assert.Fail($"'{nameof(FunctionId)}.{name}' cannot have the same value as '{nameof(FunctionId)}.{existingName}'"); } map.Add(value, name); } } }