/
githubmirror
/
aspnetcore
Обзор
Документация
Войти
/
githubmirror
/
aspnetcore
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/SignalR/common/testassets/Tests.Utils/ExceptionMessageExtensions.cs
22 строки
812 B
Pranav K
Enforce warnings for unused usings (#39280)
04 янв 2022, 00:26
Не верифицирован
04 янв 2022, 00:26
667f068
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace Microsoft.AspNetCore.SignalR.Tests; public static class ExceptionMessageExtensions { public static string GetLocalizationSafeMessage(this ArgumentException argEx) { // Strip off the last line since it's "Parameter Name: [parameterName]" and: // 1. We verify the parameter name separately // 2. It is localized, so we don't want our tests to break in non-US environments var message = argEx.Message; var lastNewline = message.LastIndexOf(" (Parameter", StringComparison.Ordinal); if (lastNewline < 0) { return message; } return message.Substring(0, lastNewline); } }