diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpCommandLineProvider.cs b/src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpCommandLineProvider.cs index 64f19e9258..c459895d01 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpCommandLineProvider.cs +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/HangDumpCommandLineProvider.cs @@ -22,12 +22,18 @@ internal sealed class HangDumpCommandLineProvider : CommandLineOptionsProviderBa private static readonly string[] HangDumpTypeOptions = ["Mini", "Heap", "Full", "None"]; #endif + private static readonly string HangDumpTypeOptionsFormatted = string.Join(", ", Array.ConvertAll(HangDumpTypeOptions, option => $"'{option}'")); + private static readonly IReadOnlyCollection CachedCommandLineOptions = [ new(HangDumpOptionName, ExtensionResources.HangDumpOptionDescription, ArgumentArity.Zero, false), new(HangDumpTimeoutOptionName, ExtensionResources.HangDumpTimeoutOptionDescription, ArgumentArity.ExactlyOne, false), new(HangDumpFileNameOptionName, ExtensionResources.HangDumpFileNameOptionDescription, ArgumentArity.ExactlyOne, false), - new(HangDumpTypeOptionName, ExtensionResources.HangDumpTypeOptionDescription, ArgumentArity.ExactlyOne, false) + new( + HangDumpTypeOptionName, + string.Format(CultureInfo.InvariantCulture, ExtensionResources.HangDumpTypeOptionDescription, HangDumpTypeOptionsFormatted), + ArgumentArity.ExactlyOne, + false) ]; public HangDumpCommandLineProvider() @@ -51,7 +57,11 @@ public override Task ValidateOptionArgumentsAsync(CommandLineO { if (!HangDumpTypeOptions.Contains(arguments[0], StringComparer.OrdinalIgnoreCase)) { - return ValidationResult.InvalidTask(string.Format(CultureInfo.InvariantCulture, ExtensionResources.HangDumpTypeOptionInvalidType, arguments[0])); + return ValidationResult.InvalidTask(string.Format( + CultureInfo.InvariantCulture, + ExtensionResources.HangDumpTypeOptionInvalidType, + arguments[0], + HangDumpTypeOptionsFormatted)); } } diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/ExtensionResources.resx b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/ExtensionResources.resx index 0f16cef8cd..25dcbdee45 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/ExtensionResources.resx +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/ExtensionResources.resx @@ -188,12 +188,12 @@ The timeout value is specified in one of the following formats: Specify the type of the dump. -Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. +Valid values are {0}. Default type is 'Full' '{0}' is not a valid dump type. -Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full' +Valid options are {1} Request of type '{0}' is not supported diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.cs.xlf b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.cs.xlf index 72873bad49..dcc55916e6 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.cs.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.cs.xlf @@ -113,18 +113,18 @@ Hodnota časového limitu se zadává v jednom z následujících formátů: Specify the type of the dump. -Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. +Valid values are {0}. Default type is 'Full' - Určete typ výpisu paměti. -Platné hodnoty jsou Mini, Heap, Triage, None (dostupné jenom v .NET 6+) nebo Full. -Výchozí typ je Full. + Specify the type of the dump. +Valid values are {0}. +Default type is 'Full' '{0}' is not a valid dump type. -Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full' - {0} není platný typ výpisu paměti. -Platné možnosti jsou Mini, Heap, Triage, None (dostupné jenom v .NET 6+) a Full. +Valid options are {1} + '{0}' is not a valid dump type. +Valid options are {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.de.xlf b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.de.xlf index 6296088253..d5159a293b 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.de.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.de.xlf @@ -113,18 +113,18 @@ Der Timeoutwert wird in einem der folgenden Formate angegeben: Specify the type of the dump. -Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. +Valid values are {0}. Default type is 'Full' - Geben Sie den Typ des Speicherabbilds an. -Gültige Werte sind „Mini“, „Heap“, „Triage“, „None“ (nur in .NET 6 und höher verfügbar) oder „Full“. -Der Standardtyp ist „Full“. + Specify the type of the dump. +Valid values are {0}. +Default type is 'Full' '{0}' is not a valid dump type. -Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full' - „{0}“ ist kein gültiger Speicherabbildtyp. -Gültige Optionen sind „Mini“, „Heap“, „Triage“ (nur in .NET 6 und höher verfügbar) und „Full“. +Valid options are {1} + '{0}' is not a valid dump type. +Valid options are {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.es.xlf b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.es.xlf index 18c5ee1b9a..e099b08c36 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.es.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.es.xlf @@ -113,18 +113,18 @@ El valor de tiempo de espera se especifica en uno de los formatos siguientes: Specify the type of the dump. -Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. +Valid values are {0}. Default type is 'Full' - Especifique el tipo de volcado. -Los valores válidos son "Mini", "Heap", "Triage", "None" (solo disponible en .NET 6+) o "Full". -El tipo predeterminado es 'Full' + Specify the type of the dump. +Valid values are {0}. +Default type is 'Full' '{0}' is not a valid dump type. -Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full' - '{0}' no es un tipo de volcado válido. -Las opciones válidas son "Mini", "Heap", "Triage", "None" (solo disponible en .NET 6+) y "Full" +Valid options are {1} + '{0}' is not a valid dump type. +Valid options are {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.fr.xlf b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.fr.xlf index 6618c85cc9..e35bee9f9d 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.fr.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.fr.xlf @@ -113,18 +113,18 @@ La valeur du délai d'expiration est spécifiée dans l'un des formats suivants Specify the type of the dump. -Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. +Valid values are {0}. Default type is 'Full' - Spécifiez le type de vidage. -Les valeurs valides sont « Mini », « Heap », « Triage », « None » (uniquement disponible dans .NET 6+) ou « Full ». -Le type par défaut est « Complet » + Specify the type of the dump. +Valid values are {0}. +Default type is 'Full' '{0}' is not a valid dump type. -Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full' - « {0} » n'est pas un type de vidage valide. -Les options valides sont « Mini », « Heap », « Triage », « None » (uniquement disponible dans .NET 6+) et « Full » +Valid options are {1} + '{0}' is not a valid dump type. +Valid options are {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.it.xlf b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.it.xlf index e7da367e4a..5df347c696 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.it.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.it.xlf @@ -113,18 +113,18 @@ Il valore del timeout è specificato in uno dei formati seguenti: Specify the type of the dump. -Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. +Valid values are {0}. Default type is 'Full' - Specificare il tipo di dump. -I valori validi sono 'Mini', 'Heap', 'Triage', 'None' (disponibile solo in .NET 6+) o 'Full'. -Il tipo predefinito è 'Full' + Specify the type of the dump. +Valid values are {0}. +Default type is 'Full' '{0}' is not a valid dump type. -Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full' - '{0}' non è un tipo di dump valido. -Le opzioni valide sono 'Mini', 'Heap', 'Triage', 'None' (disponibile solo in .NET 6+) e 'Full' +Valid options are {1} + '{0}' is not a valid dump type. +Valid options are {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.ja.xlf b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.ja.xlf index 0640c8ec60..a331498552 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.ja.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.ja.xlf @@ -113,18 +113,18 @@ The timeout value is specified in one of the following formats: Specify the type of the dump. -Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. +Valid values are {0}. Default type is 'Full' - ダンプの型を指定します。 -有効な値は、'Mini'、'Heap'、'Triage'、'None' (.NET 6 以降でのみ利用可能)、または 'Full' です。 -既定の型は 'Full' です + Specify the type of the dump. +Valid values are {0}. +Default type is 'Full' '{0}' is not a valid dump type. -Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full' - '{0}' は有効なダンプの型ではありません。 -有効なオプションは、'Mini'、'Heap'、'Triage'、'None' (.NET 6 以降でのみ利用可能)、'Full' です +Valid options are {1} + '{0}' is not a valid dump type. +Valid options are {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.ko.xlf b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.ko.xlf index f590370ae0..3f7e28d5a0 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.ko.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.ko.xlf @@ -113,18 +113,18 @@ The timeout value is specified in one of the following formats: Specify the type of the dump. -Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. +Valid values are {0}. Default type is 'Full' - 덤프의 유형을 지정합니다. -유효한 값은 'Mini', 'Heap', 'Triage', 'None'(.NET 6+에서만 사용 가능) 또는 'Full'입니다. -기본 유형은 'Full'입니다. + Specify the type of the dump. +Valid values are {0}. +Default type is 'Full' '{0}' is not a valid dump type. -Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full' - '{0}'은(는) 올바른 덤프 유형이 아닙니다. -유효한 옵션은 'Mini', 'Heap', 'Triage', 'None'(.NET 6 이상에서만 사용 가능) 및 'Full'입니다. +Valid options are {1} + '{0}' is not a valid dump type. +Valid options are {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.pl.xlf b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.pl.xlf index 4cf1b7fade..21d78b4976 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.pl.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.pl.xlf @@ -113,18 +113,18 @@ Wartość limitu czasu jest określana w jednym z następujących formatów: Specify the type of the dump. -Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. +Valid values are {0}. Default type is 'Full' - Określ typ zrzutu. -Prawidłowe wartości to „Mini”, „Heap”, „Triage”, „None” (dostępne tylko na platformie .NET 6+) lub „Full”. -Domyślny typ to „Full” + Specify the type of the dump. +Valid values are {0}. +Default type is 'Full' '{0}' is not a valid dump type. -Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full' - „{0}” nie jest prawidłowym typem zrzutu. -Prawidłowe opcje to „Mini”, „Heap”, „Triage”, „None” (dostępne tylko na platformie .NET 6+) i „Full” +Valid options are {1} + '{0}' is not a valid dump type. +Valid options are {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.pt-BR.xlf b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.pt-BR.xlf index ec0ba6e4dd..33157767a3 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.pt-BR.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.pt-BR.xlf @@ -113,18 +113,18 @@ O valor de tempo limite é especificado em um dos seguintes formatos: Specify the type of the dump. -Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. +Valid values are {0}. Default type is 'Full' - Especifique o tipo do despejo. -Os valores válidos são "Mini", "Heap", "Triage", "None" (disponível somente no .NET 6+) ou "Full". -O tipo padrão é ''Full'' + Specify the type of the dump. +Valid values are {0}. +Default type is 'Full' '{0}' is not a valid dump type. -Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full' - "{0}" não é um tipo de despejo válido. -As opções válidas são "Mini", "Heap", "Triage", "None" (disponível somente no .NET 6+) e "Full" +Valid options are {1} + '{0}' is not a valid dump type. +Valid options are {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.ru.xlf b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.ru.xlf index 90a775ca3f..8af82153ba 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.ru.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.ru.xlf @@ -113,18 +113,18 @@ The timeout value is specified in one of the following formats: Specify the type of the dump. -Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. +Valid values are {0}. Default type is 'Full' - Укажите тип дампа. -Допустимые значения: "Mini", "Heap", "Triage", "None" (доступно только в .NET 6+) или "Full". -Тип по умолчанию — "Full" + Specify the type of the dump. +Valid values are {0}. +Default type is 'Full' '{0}' is not a valid dump type. -Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full' - "{0}" не является допустимым типом дампа. -Допустимые параметры: "Mini", "Heap", "Triage", "None" (доступно только в .NET 6+) и "Full" +Valid options are {1} + '{0}' is not a valid dump type. +Valid options are {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.tr.xlf b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.tr.xlf index e55b8a5f66..e4b3678ded 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.tr.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.tr.xlf @@ -113,18 +113,18 @@ Zaman aşımı değeri, aşağıdaki biçimlerden biri ile belirtilir: Specify the type of the dump. -Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. +Valid values are {0}. Default type is 'Full' - Dökümün türünü belirtin. -Geçerli değerler: 'Mini', 'Heap', 'Triage', 'None' (yalnızca .NET 6+ sürümlerinde kullanılabilir) veya 'Full'. -Varsayılan tür: 'Full' + Specify the type of the dump. +Valid values are {0}. +Default type is 'Full' '{0}' is not a valid dump type. -Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full' - '{0}' geçerli bir döküm türü değil. -Geçerli seçenekler: 'Mini', 'Heap', 'Triage', 'None' (yalnızca .NET 6+ sürümlerinde kullanılabilir) ve 'Full' +Valid options are {1} + '{0}' is not a valid dump type. +Valid options are {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.zh-Hans.xlf b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.zh-Hans.xlf index c3b1170bf1..d56ed9a428 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.zh-Hans.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.zh-Hans.xlf @@ -113,18 +113,18 @@ The timeout value is specified in one of the following formats: Specify the type of the dump. -Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. +Valid values are {0}. Default type is 'Full' - 指定转储的类型。 -有效值为 "Mini"、"Heap"、"Triage"(仅适用于 .NET 6+)或 "Full"。 -默认类型为 "Full" + Specify the type of the dump. +Valid values are {0}. +Default type is 'Full' '{0}' is not a valid dump type. -Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full' - “{0}”不是有效的转储类型。 -有效选项为 "Mini"、"Heap"、"Triage"(仅适用于 .NET 6+)和 "Full" +Valid options are {1} + '{0}' is not a valid dump type. +Valid options are {1} diff --git a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.zh-Hant.xlf b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.zh-Hant.xlf index 49590e4e13..6c8f768ab9 100644 --- a/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.zh-Hant.xlf +++ b/src/Platform/Microsoft.Testing.Extensions.HangDump/Resources/xlf/ExtensionResources.zh-Hant.xlf @@ -113,18 +113,18 @@ The timeout value is specified in one of the following formats: Specify the type of the dump. -Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. +Valid values are {0}. Default type is 'Full' - 指定傾印的類型。 -有效值為 'Mini'、'Heap'、'Triage'、'None' (僅適用 .NET 6+) 或 'Full'。 -預設類型為 'Full' + Specify the type of the dump. +Valid values are {0}. +Default type is 'Full' '{0}' is not a valid dump type. -Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full' - '{0}' 不是有效的傾印類型。 -有效的選項為 'Mini'、'Heap'、'Triage'、'None' (僅適用 .NET 6+) 和 'Full' +Valid options are {1} + '{0}' is not a valid dump type. +Valid options are {1} diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpTests.cs index 54d45b780d..427fbaceae 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HangDumpTests.cs @@ -244,7 +244,7 @@ public async Task HangDump_InvalidFormat_ShouldFail() testHostResult.AssertExitCodeIs(ExitCode.InvalidCommandLine); testHostResult.AssertOutputContains(""" Option '--hangdump-type' has invalid arguments: 'invalid' is not a valid dump type. - Valid options are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) and 'Full' + Valid options are 'Mini', 'Heap', 'Full', 'Triage', 'None' """); } diff --git a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs index 16ec65ffd8..123c596fc6 100644 --- a/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs +++ b/test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/HelpInfoAllExtensionsTests.cs @@ -108,7 +108,7 @@ Specify the timeout after which the dump will be generated. Default is 30m. --hangdump-type Specify the type of the dump. - Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. + Valid values are {{GetExpectedHangDumpDescriptionOptions(tfm)}}. Default type is 'Full' --publish-azdo-run-name Custom Azure DevOps test run name for live test-result publishing. @@ -443,7 +443,7 @@ Default is 30m. Arity: 1 Hidden: False Description: Specify the type of the dump. - Valid values are 'Mini', 'Heap', 'Triage', 'None' (only available in .NET 6+) or 'Full'. + Valid values are {{GetExpectedHangDumpDescriptionOptions(tfm)}}. Default type is 'Full' HtmlReportGeneratorCommandLine Name: HTML report generator @@ -532,6 +532,11 @@ Default type is 'Full' testHostResult.AssertOutputMatchesLines(wildcardPattern); } + private static string GetExpectedHangDumpDescriptionOptions(string tfm) + => TargetFrameworks.NetFramework.Contains(tfm) + ? "'Mini', 'Heap', 'Full', 'None'" + : "'Mini', 'Heap', 'Full', 'Triage', 'None'"; + public sealed class TestAssetFixture() : TestAssetFixtureBase() { public const string AllExtensionsAssetName = "AllExtensionsInfoTest"; diff --git a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/HangDumpTests.cs b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/HangDumpTests.cs index 7a948c18fa..2dfd1e1a9e 100644 --- a/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/HangDumpTests.cs +++ b/test/UnitTests/Microsoft.Testing.Extensions.UnitTests/HangDumpTests.cs @@ -50,6 +50,7 @@ public async Task IsInvalid_If_Timeout_Value_Has_IncorrectValue() [DataRow("Mini")] [DataRow("Heap")] [DataRow("Full")] + [DataRow("None")] public async Task IsValid_If_HangDumpType_Has_CorrectValue(string dumpType) { HangDumpCommandLineProvider hangDumpCommandLineProvider = GetProvider(); @@ -68,7 +69,24 @@ public async Task IsInvalid_If_HangDumpType_Has_IncorrectValue() ValidationResult validateOptionsResult = await hangDumpCommandLineProvider.ValidateOptionArgumentsAsync(option, ["invalid"]).ConfigureAwait(false); Assert.IsFalse(validateOptionsResult.IsValid); - Assert.AreEqual(string.Format(CultureInfo.InvariantCulture, ExtensionResources.HangDumpTypeOptionInvalidType, "invalid"), validateOptionsResult.ErrorMessage); + Assert.AreEqual( + string.Format( + CultureInfo.InvariantCulture, + ExtensionResources.HangDumpTypeOptionInvalidType, + "invalid", + GetExpectedFormattedOptions()), + validateOptionsResult.ErrorMessage); + } + + [TestMethod] + public void HangDumpTypeOptionDescription_ListsValidValues() + { + HangDumpCommandLineProvider hangDumpCommandLineProvider = GetProvider(); + CommandLineOption option = hangDumpCommandLineProvider.GetCommandLineOptions().First(x => x.Name == HangDumpCommandLineProvider.HangDumpTypeOptionName); + + Assert.AreEqual( + string.Format(CultureInfo.InvariantCulture, ExtensionResources.HangDumpTypeOptionDescription, GetExpectedFormattedOptions()), + option.Description); } [TestMethod] @@ -117,4 +135,10 @@ public void GetDumpFileNames_WindowsPathWithSpaces_QuotesOnlyWriteDumpArgument() Assert.AreEqual($"\"{dumpFileName}\"", dumpFileNames.WriteDumpFileName); Assert.AreEqual(dumpFileName, dumpFileNames.ArtifactDumpFileName); } + +#if NETCOREAPP + private static string GetExpectedFormattedOptions() => "'Mini', 'Heap', 'Full', 'Triage', 'None'"; +#else + private static string GetExpectedFormattedOptions() => "'Mini', 'Heap', 'Full', 'None'"; +#endif }