/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Compilers/Core/CodeAnalysisTest/SourceFileResolverTest.cs
69 строк
2 KB
Jason Malinowski
Remove AssertEx.Fail
21 апр 2026, 23:28
21 апр 2026, 23:28
7b44707
Код
Авторство
О чём код?
// 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 Roslyn.Test.Utilities; using Roslyn.Utilities; using System; using System.Collections.Generic; using System.Collections.Immutable; using System.IO; using Xunit; namespace Microsoft.CodeAnalysis.UnitTests { public class SourceFileResolverTest { [Fact] public void IncorrectPathmaps() { string isABaseDirectory; if (Path.DirectorySeparatorChar == '/') { isABaseDirectory = "/"; } else { isABaseDirectory = "C://"; } try { new SourceFileResolver( ImmutableArray.Create(""), isABaseDirectory, ImmutableArray.Create(KeyValuePair.Create<string, string>("key", null))); Assert.Fail("Didn't throw"); } catch (ArgumentException argException) { Assert.Equal(new ArgumentException(CodeAnalysisResources.NullValueInPathMap, "pathMap").Message, argException.Message); } // Empty pathmap value doesn't throw new SourceFileResolver( ImmutableArray.Create(""), isABaseDirectory, ImmutableArray.Create(KeyValuePair.Create("key", ""))); } [Fact] public void BadBaseDirectory() { try { new SourceFileResolver( [""], "not_a_root directory", [KeyValuePair.Create("key", "value")]); Assert.Fail("Didn't throw"); } catch (ArgumentException argException) { Assert.Equal(new ArgumentException(CodeAnalysisResources.AbsolutePathExpected, "baseDirectory").Message, argException.Message); } } } }