Skip to content

Commit

Permalink
[rel/3.7] Fix DynamicData.GetData regression preventing it to work wi…
Browse files Browse the repository at this point in the history
…thout adapter (#4626)

Co-authored-by: Youssef1313 <youssefvictor00@gmail.com>
  • Loading branch information
youssef-backport-bot and Youssef1313 authored Jan 13, 2025
1 parent 6a2a942 commit 0ed409d
Show file tree
Hide file tree
Showing 24 changed files with 126 additions and 141 deletions.
13 changes: 3 additions & 10 deletions src/Adapter/MSTest.TestAdapter/PlatformServiceProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,9 @@ internal sealed class PlatformServiceProvider : IPlatformServiceProvider
/// <summary>
/// Initializes a new instance of the <see cref="PlatformServiceProvider"/> class - a singleton.
/// </summary>
private PlatformServiceProvider() =>
#if !WINDOWS_UWP
// Set the provider that is used by DynamicDataAttribute when generating data, to allow substituting functionality
// in TestFramework without having to put all the stuff in that library.
TestTools.UnitTesting.DynamicDataProvider.Instance = SourceGeneratorToggle.UseSourceGenerator
? new SourceGeneratedDynamicDataOperations()
: new DynamicDataOperations();
#else
TestTools.UnitTesting.DynamicDataProvider.Instance = new DynamicDataOperations();
#endif
private PlatformServiceProvider()
{
}

/// <summary>
/// Gets an instance to the platform service validator for test sources.
Expand Down
9 changes: 0 additions & 9 deletions src/Adapter/MSTest.TestAdapter/Resources/Resource.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/Adapter/MSTest.TestAdapter/Resources/Resource.resx
Original file line number Diff line number Diff line change
Expand Up @@ -411,9 +411,6 @@ but received {4} argument(s), with types '{5}'.</value>
<data name="InvalidValue" xml:space="preserve">
<value>Invalid value '{0}' for runsettings entry '{1}', setting will be ignored.</value>
</data>
<data name="DynamicDataShouldBeValidMessageFormat_MemberType" xml:space="preserve">
<value>'[DynamicData]' referenced member '{0}.{1}' should return 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` or 'IEnumerable&lt;ValueTuple&gt;'</value>
</data>
<data name="DuplicateConfigurationError" xml:space="preserve">
<value>Both '.runsettings' and '.testconfig.json' files have been detected. Please select only one of these test configuration files.</value>
</data>
Expand Down
5 changes: 0 additions & 5 deletions src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.cs.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ byl však přijat tento počet argumentů: {4} s typy {5}.</target>
<target state="translated">Byly zjištěny soubory .runsettings i .testconfig.json. Vyberte prosím jenom jeden z těchto souborů konfigurace testu.</target>
<note />
</trans-unit>
<trans-unit id="DynamicDataShouldBeValidMessageFormat_MemberType">
<source>'[DynamicData]' referenced member '{0}.{1}' should return 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` or 'IEnumerable&lt;ValueTuple&gt;'</source>
<target state="translated">Odkazovaný člen [DynamicData] {0}.{1} by měl vracet IEnumerable&lt;object[]&gt;, IEnumerable&lt;Tuple&gt; nebo IEnumerable&lt;ValueTuple&gt;.</target>
<note />
</trans-unit>
<trans-unit id="Execution_Test_Timeout">
<source>Test '{0}' exceeded execution timeout period.</source>
<target state="translated">Test {0} překročil časový limit spuštění.</target>
Expand Down
5 changes: 0 additions & 5 deletions src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ aber empfing {4} Argument(e) mit den Typen „{5}“.</target>
<target state="translated">Es wurden sowohl die Dateien „.runsettings“ als auch „.testconfig.json“ erkannt. Wählen Sie nur eine dieser Testkonfigurationsdateien aus.</target>
<note />
</trans-unit>
<trans-unit id="DynamicDataShouldBeValidMessageFormat_MemberType">
<source>'[DynamicData]' referenced member '{0}.{1}' should return 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` or 'IEnumerable&lt;ValueTuple&gt;'</source>
<target state="translated">"[DynamicData]"-Element "{0}.{1}" muss "IEnumerable"&lt;"object[]&gt;", "IEnumerable&lt;Tuple&gt;" oder "IEnumerable&lt;ValueTuple&gt;" zurückgeben.</target>
<note />
</trans-unit>
<trans-unit id="Execution_Test_Timeout">
<source>Test '{0}' exceeded execution timeout period.</source>
<target state="translated">Der Test "{0}" hat das Ausführungstimeout überschritten.</target>
Expand Down
5 changes: 0 additions & 5 deletions src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.es.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ pero recibió {4} argumento(s), con los tipos "{5}".</target>
<target state="translated">Se han detectado los archivos ".runsettings" y ".testconfig.json". Seleccione solo uno de estos archivos de configuración de prueba.</target>
<note />
</trans-unit>
<trans-unit id="DynamicDataShouldBeValidMessageFormat_MemberType">
<source>'[DynamicData]' referenced member '{0}.{1}' should return 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` or 'IEnumerable&lt;ValueTuple&gt;'</source>
<target state="translated">El miembro ''{0}.{1}'' de '[DynamicData]' al que se hace referencia debe devolver ''IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;'' o ''IEnumerable&lt;ValueTuple&gt;''</target>
<note />
</trans-unit>
<trans-unit id="Execution_Test_Timeout">
<source>Test '{0}' exceeded execution timeout period.</source>
<target state="translated">La prueba '{0}' superó el tiempo de espera de ejecución.</target>
Expand Down
5 changes: 0 additions & 5 deletions src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.fr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ mais a reçu {4} argument(s), avec les types « {5} ».</target>
<target state="translated">Les fichiers « .runsettings » et « .testconfig.json » ont été détectés. Veuillez sélectionner un seul de ces fichiers de configuration de test.</target>
<note />
</trans-unit>
<trans-unit id="DynamicDataShouldBeValidMessageFormat_MemberType">
<source>'[DynamicData]' referenced member '{0}.{1}' should return 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` or 'IEnumerable&lt;ValueTuple&gt;'</source>
<target state="translated">Le membre référencé « [DynamicData] '{0}.{1}' doit renvoyer « IEnumerable&lt;object[]&gt; », « IEnumerable&lt;Tuple&gt; » ou « IEnumerable&lt;ValueTuple&gt; »</target>
<note />
</trans-unit>
<trans-unit id="Execution_Test_Timeout">
<source>Test '{0}' exceeded execution timeout period.</source>
<target state="translated">Le test '{0}' a dépassé le délai d'attente de l'exécution.</target>
Expand Down
5 changes: 0 additions & 5 deletions src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.it.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ ma ha ricevuto {4} argomenti, con tipi "{5}".</target>
<target state="translated">Sono stati rilevati sia i file '.runsettings' sia '.testconfig.json'. Selezionare solo uno di questi file di configurazione di test.</target>
<note />
</trans-unit>
<trans-unit id="DynamicDataShouldBeValidMessageFormat_MemberType">
<source>'[DynamicData]' referenced member '{0}.{1}' should return 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` or 'IEnumerable&lt;ValueTuple&gt;'</source>
<target state="translated">'[DynamicData]' membro di riferimento '{0}.{1}' deve restituire 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;' o 'IEnumerable&lt;ValueTuple&gt;'</target>
<note />
</trans-unit>
<trans-unit id="Execution_Test_Timeout">
<source>Test '{0}' exceeded execution timeout period.</source>
<target state="translated">È stato superato il periodo di timeout per l'esecuzione del test '{0}'.</target>
Expand Down
5 changes: 0 additions & 5 deletions src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.ja.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ but received {4} argument(s), with types '{5}'.</source>
<target state="translated">'.runsettings' ファイルと '.testconfig.json' ファイルの両方が検出されました。これらのテスト構成ファイルのいずれか 1 つだけを選択してください。</target>
<note />
</trans-unit>
<trans-unit id="DynamicDataShouldBeValidMessageFormat_MemberType">
<source>'[DynamicData]' referenced member '{0}.{1}' should return 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` or 'IEnumerable&lt;ValueTuple&gt;'</source>
<target state="translated">'[DynamicData]' の参照されるメンバー '{0}.{1}' は、'IEnumerable&lt;object[]&gt;'、'IEnumerable&lt;Tuple&gt;`、'IEnumerable&lt;ValueTuple&gt;' のいずれかを返す必要があります</target>
<note />
</trans-unit>
<trans-unit id="Execution_Test_Timeout">
<source>Test '{0}' exceeded execution timeout period.</source>
<target state="translated">テスト '{0}' は実行タイムアウトを超えました。</target>
Expand Down
5 changes: 0 additions & 5 deletions src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.ko.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ but received {4} argument(s), with types '{5}'.</source>
<target state="translated">'.runsettings' 및 '.testconfig.json' 파일이 모두 검색되었습니다. 이러한 테스트 구성 파일 중 하나만 선택하세요.</target>
<note />
</trans-unit>
<trans-unit id="DynamicDataShouldBeValidMessageFormat_MemberType">
<source>'[DynamicData]' referenced member '{0}.{1}' should return 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` or 'IEnumerable&lt;ValueTuple&gt;'</source>
<target state="translated">'[DynamicData]'이(가) '{0} 멤버를 참조했습니다.{1}'은(는) 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;' 또는 'IEnumerable&lt;ValueTuple&gt;'을 반환해야 합니다.</target>
<note />
</trans-unit>
<trans-unit id="Execution_Test_Timeout">
<source>Test '{0}' exceeded execution timeout period.</source>
<target state="translated">'{0}' 테스트가 실행 시간 제한을 초과했습니다.</target>
Expand Down
5 changes: 0 additions & 5 deletions src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.pl.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ ale liczba odebranych argumentów to {4} z typami „{5}”.</target>
<target state="translated">Wykryto zarówno pliki „.runsettings”, jak i „.testconfig.json”. Wybierz tylko jeden z tych plików konfiguracji testu.</target>
<note />
</trans-unit>
<trans-unit id="DynamicDataShouldBeValidMessageFormat_MemberType">
<source>'[DynamicData]' referenced member '{0}.{1}' should return 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` or 'IEnumerable&lt;ValueTuple&gt;'</source>
<target state="translated">Przywołany element członkowski „{0}.{1}” „[DynamicData]” powinien zwrócić „IEnumerable&lt;object[]&gt;”, „IEnumerable&lt;Tuple&gt;” lub „IEnumerable&lt;ValueTuple&gt;”</target>
<note />
</trans-unit>
<trans-unit id="Execution_Test_Timeout">
<source>Test '{0}' exceeded execution timeout period.</source>
<target state="translated">Test „{0}” przekroczył okres limitu czasu na wykonanie.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ mas {4} argumentos recebidos, com tipos '{5}'.</target>
<target state="translated">Ambos os arquivos '.runsettings' e '.testconfig.json' foram detectados. Selecione apenas um desses arquivos de configuração de teste.</target>
<note />
</trans-unit>
<trans-unit id="DynamicDataShouldBeValidMessageFormat_MemberType">
<source>'[DynamicData]' referenced member '{0}.{1}' should return 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` or 'IEnumerable&lt;ValueTuple&gt;'</source>
<target state="translated">O membro referenciado "{0}.{1}" de "[DynamicData]" deve retornar "IEnumerable&lt;object[]&gt;", "IEnumerable&lt;Tuple&gt;" ou "IEnumerable&lt;ValueTuple&gt;"</target>
<note />
</trans-unit>
<trans-unit id="Execution_Test_Timeout">
<source>Test '{0}' exceeded execution timeout period.</source>
<target state="translated">Teste '{0}' ultrapassou o período de tempo limite de execução.</target>
Expand Down
5 changes: 0 additions & 5 deletions src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.ru.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ but received {4} argument(s), with types '{5}'.</source>
<target state="translated">Обнаружены файлы ".runsettings" и ".testconfig.json". Выберите только один из этих файлов тестовой конфигурации.</target>
<note />
</trans-unit>
<trans-unit id="DynamicDataShouldBeValidMessageFormat_MemberType">
<source>'[DynamicData]' referenced member '{0}.{1}' should return 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` or 'IEnumerable&lt;ValueTuple&gt;'</source>
<target state="translated">Указанный элемент "[DynamicData]" "{0}.{1}" должен возвращать "IEnumerable&lt;object[]&gt;", "IEnumerable&lt;Tuple&gt;" или "IEnumerable&lt;ValueTuple&gt;"</target>
<note />
</trans-unit>
<trans-unit id="Execution_Test_Timeout">
<source>Test '{0}' exceeded execution timeout period.</source>
<target state="translated">Превышено время ожидания выполнения теста "{0}".</target>
Expand Down
5 changes: 0 additions & 5 deletions src/Adapter/MSTest.TestAdapter/Resources/xlf/Resource.tr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ ancak, '{5}' türüyle {4} argüman aldı.</target>
<target state="translated">Hem '.runsettings' hem de '.testconfig.json' dosyaları algılandı. Lütfen bu test yapılandırma dosyalarından yalnızca birini seçin.</target>
<note />
</trans-unit>
<trans-unit id="DynamicDataShouldBeValidMessageFormat_MemberType">
<source>'[DynamicData]' referenced member '{0}.{1}' should return 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` or 'IEnumerable&lt;ValueTuple&gt;'</source>
<target state="translated">'[DynamicData]' başvurulan üyesi '{0}.{1}' şu değerleri döndürmelidir: 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` veya 'IEnumerable&lt;ValueTuple&gt;'</target>
<note />
</trans-unit>
<trans-unit id="Execution_Test_Timeout">
<source>Test '{0}' exceeded execution timeout period.</source>
<target state="translated">'{0}' testi yürütme zaman aşımı süresini aştı.</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ but received {4} argument(s), with types '{5}'.</source>
<target state="translated">检测到 ".runsettings" 和 ".testconfig.json" 文件。请仅选择其中一个测试配置文件。</target>
<note />
</trans-unit>
<trans-unit id="DynamicDataShouldBeValidMessageFormat_MemberType">
<source>'[DynamicData]' referenced member '{0}.{1}' should return 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` or 'IEnumerable&lt;ValueTuple&gt;'</source>
<target state="translated">“[DynamicData]”引用的成员“{0}.{1}”应返回“IEnumerable&lt;object[]&gt;”、“IEnumerable&lt;Tuple&gt;”或“IEnumerable&lt;ValueTuple&gt;”</target>
<note />
</trans-unit>
<trans-unit id="Execution_Test_Timeout">
<source>Test '{0}' exceeded execution timeout period.</source>
<target state="translated">测试“{0}”的执行超时。</target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,6 @@ but received {4} argument(s), with types '{5}'.</source>
<target state="translated">偵測到 '.runsettings' 和 '.testconfig.json' 檔案。請只選取其中一個測試設定檔。</target>
<note />
</trans-unit>
<trans-unit id="DynamicDataShouldBeValidMessageFormat_MemberType">
<source>'[DynamicData]' referenced member '{0}.{1}' should return 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` or 'IEnumerable&lt;ValueTuple&gt;'</source>
<target state="translated">'[DynamicData]' 參考成員 '{0}.{1}' 應傳回 'IEnumerable&lt;object[]&gt;', 'IEnumerable&lt;Tuple&gt;` or 'IEnumerable&lt;ValueTuple&gt;'</target>
<note />
</trans-unit>
<trans-unit id="Execution_Test_Timeout">
<source>Test '{0}' exceeded execution timeout period.</source>
<target state="translated">測試 '{0}' 超過執行逾時期限。</target>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ public DynamicDataAttribute(string dynamicDataSourceName, Type dynamicDataDeclar
public TestDataSourceUnfoldingStrategy UnfoldingStrategy { get; set; } = TestDataSourceUnfoldingStrategy.Auto;

/// <inheritdoc />
public IEnumerable<object[]> GetData(MethodInfo methodInfo) => DynamicDataProvider.Instance.GetData(_dynamicDataDeclaringType, _dynamicDataSourceType, _dynamicDataSourceName, methodInfo);
public IEnumerable<object[]> GetData(MethodInfo methodInfo)
=> DynamicDataOperations.GetData(_dynamicDataDeclaringType, _dynamicDataSourceType, _dynamicDataSourceName, methodInfo);

/// <inheritdoc />
public string? GetDisplayName(MethodInfo methodInfo, object?[]? data)
Expand Down
Loading

0 comments on commit 0ed409d

Please sign in to comment.