Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use TestMethod instead of DataTestMethod #729

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="[13.0.1,)" />
<PackageReference Include="System.Text.Json" Version="[6.0,)" />
<PackageReference Include="System.Text.Json" Version="6.0.10" />
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" />
<PackageReference Include="YamlDotNet" Version="$(YamlDotNetVersion)" />
</ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/PAModelTests/AppTestsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace PAModelTests;
public class AppTestsTest
{
// Validates that the App can be repacked after deleting the EditorState files, when the app contains app tests which refer to screens.
[DataTestMethod]
[TestMethod]
[DataRow("TestStudio_Test.msapp")]
public void TestPackWhenEditorStateIsDeleted(string appName)
{
Expand Down Expand Up @@ -48,7 +48,7 @@ public void TestPackWhenEditorStateIsDeleted(string appName)
}

// Validates that the App can be repacked after deleting the Entropy files, when the app contains app tests which refer to screens.
[DataTestMethod]
[TestMethod]
[DataRow("TestStudio_Test.msapp")]
public void TestPackWhenEntropyIsDeleted(string appName)
{
Expand Down
6 changes: 3 additions & 3 deletions src/PAModelTests/ChecksumTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace PAModelTests;
[TestClass]
public class ChecksumTests
{
[DataTestMethod]
[TestMethod]
[DataRow("MyWeather.msapp", "C8_ZXZwZAG3P0lmCkNAGjsIjYb503akWCyudsk8DEi2aX0=", 11, "References\\DataSources.json", "C8_2dpVudcymwNaHoHtQugF1MSpzsY1I6syuPiB0B+jTYc=")]
public void TestChecksum(string filename, string expectedChecksum, int expectedFileCount, string file, string innerExpectedChecksum)
{
Expand All @@ -29,7 +29,7 @@ public void TestChecksum(string filename, string expectedChecksum, int expectedF
Assert.AreEqual(ChecksumMaker.GetChecksumVersion(expectedChecksum), ChecksumMaker.Version);
}

[DataTestMethod]
[TestMethod]
[DataRow("a bc", "a bc")]
[DataRow(" a b ", "a b")] // leading, trailing
[DataRow("a\t\r\nb", "a b")] // other chars
Expand Down Expand Up @@ -80,7 +80,7 @@ public void ChecksumsUnique()
private const string C20 = "C8_2YUFpLVLEYtdFvV9iLN8F6TM+cWczemMx4m0VEIpfrg=";


[DataTestMethod]
[TestMethod]
[DataRow(C1, /*lang=json*/ @"' ab\r\ncd'")] // whitespace
[DataRow(C1, /*lang=json*/ @"'ab\ncd'")] // same
[DataRow(C2, /*lang=json*/ @"'ab\ncd '")] // Trailing whitespace is not trimmed.
Expand Down
18 changes: 9 additions & 9 deletions src/PAModelTests/DataSourceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace PAModelTests;
public class DataSourceTests
{
// Validates that the TableDefinitions are being added at the end of the DataSources.json when the entropy file is deleted.
[DataTestMethod]
[TestMethod]
[DataRow("GalleryTestApp.msapp")]
[DataRow("AccountPlanReviewerMaster.msapp")]
public void TestTableDefinitionsAreLastEntriesWhenEntropyDeleted(string appName)
Expand Down Expand Up @@ -78,7 +78,7 @@ public void TestTableDefinitionsAreLastEntriesWhenEntropyDeleted(string appName)
}
}

[DataTestMethod]
[TestMethod]
[DataRow("EmptyLocalDBRefsHashMismatchProperties.msapp")]
public void TestNoLocalDatabaseRefsWhenLocalDatabaseReferencesPropertyWasEmptyJson(string appName)
{
Expand All @@ -98,7 +98,7 @@ public void TestNoLocalDatabaseRefsWhenLocalDatabaseReferencesPropertyWasEmptyJs
Assert.IsTrue(loadedMsApp._dataSourceReferences.Count == 0);
}

[DataTestMethod]
[TestMethod]
[DataRow("EmptyLocalDBRefsHashMismatchProperties.msapp")]
public void TestConnectionInstanceIDHandling(string appName)
{
Expand All @@ -117,7 +117,7 @@ public void TestConnectionInstanceIDHandling(string appName)
errorsCaptured.ThrowOnErrors();
}

[DataTestMethod]
[TestMethod]
[DataRow("MultipleDataSourcesWithOneUnused.msapp")]
public void TestUnusedDataSourcesArePreserved(string appName)
{
Expand Down Expand Up @@ -152,7 +152,7 @@ public void TestUnusedDataSourcesArePreserved(string appName)
}
}

[DataTestMethod]
[TestMethod]
[DataRow("MultipleDataSourcesWithOneUnused.msapp")]
public void TestUnusedDataSourcesAreNotPreservedWhenNotTracked(string appName)
{
Expand Down Expand Up @@ -187,7 +187,7 @@ public void TestUnusedDataSourcesAreNotPreservedWhenNotTracked(string appName)
}
}

[DataTestMethod]
[TestMethod]
[DataRow("MultipleDataSourcesWithOneUnused.msapp")]
public void TestWhenDataSourcesAreNotPresent(string appName)
{
Expand All @@ -213,7 +213,7 @@ public void TestWhenDataSourcesAreNotPresent(string appName)
Assert.IsNull(msApp._dataSourceReferences.First().Value.dataSources);
}

[DataTestMethod]
[TestMethod]
[DataRow("MultipleDataSourcesWithOneUnused.msapp")]
public void TestWhenDataSourcesIsSetToEmptyDictionary(string appName)
{
Expand All @@ -238,7 +238,7 @@ public void TestWhenDataSourcesIsSetToEmptyDictionary(string appName)
Assert.AreEqual(msApp._dataSourceReferences.First().Value.dataSources.Count, 0);
}

[DataTestMethod]
[TestMethod]
[DataRow("NoUnusedDataSources.msapp")]
public void TestAllUsedDataSourcesArePreserved(string appName)
{
Expand All @@ -262,7 +262,7 @@ public void TestAllUsedDataSourcesArePreserved(string appName)
}
}

[DataTestMethod]
[TestMethod]
[DataRow(new string[] { "FileNameOne.txt" }, ".txt")]
[DataRow(new string[] { "FileNameTwo.tx<t" }, ".tx%3ct")]
[DataRow(new string[] { "FileNameThr<ee.txt" }, ".txt")]
Expand Down
6 changes: 3 additions & 3 deletions src/PAModelTests/EditorStateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class EditorStateTests
/// <summary>
/// Tests that the top parent name is set properly on the editor state file.
/// </summary>
[DataTestMethod]
[TestMethod]
[DataRow("AppWithLabel.msapp", "Screen1")]
[DataRow("DuplicateScreen.msapp", "Screen1")]
public void TestTopParentSerialization(string appName, string topParentName)
Expand Down Expand Up @@ -57,7 +57,7 @@ public void TestTopParentSerialization(string appName, string topParentName)
/// Tests that the `TopParentName` for each control is set to the correct
/// value when the app is deserialized.
/// </summary>
[DataTestMethod]
[TestMethod]
[DataRow("AppWithLabel.msapp", "Screen1")]
[DataRow("DuplicateScreen.msapp", "Screen1")]
public void TestTopParentNameLoad(string appName, string topParentName)
Expand Down Expand Up @@ -118,7 +118,7 @@ public void TestTopParentNameLoad(string appName, string topParentName)
///
/// When SourceSerializer is updated past v24, this could be removed entirely.
/// </summary>
[DataTestMethod]
[TestMethod]
[DataRow("AppWithLabel.msapp", "Screen1")]
[DataRow("DuplicateScreen.msapp", "Screen1")]
public void TestTopParentNameFallback(string appName, string topParentName)
Expand Down
16 changes: 8 additions & 8 deletions src/PAModelTests/EntropyTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace PAModelTests;
[TestClass]
public class EntropyTests
{
[DataTestMethod]
[TestMethod]
[DataRow("ComponentTest.msapp", true)]
[DataRow("ComponentWithSameParam.msapp", false)]
public void TestFunctionParameters(string filename, bool invariantScriptsOnInstancesExist)
Expand All @@ -38,7 +38,7 @@ public void TestFunctionParameters(string filename, bool invariantScriptsOnInsta
}
}

[DataTestMethod]
[TestMethod]
[DataRow("AnimationControlIdIsGuid.msapp")]
public void TestControlIdGuidParsing(string filename)
{
Expand All @@ -52,7 +52,7 @@ public void TestControlIdGuidParsing(string filename)
Assert.AreEqual(msapp._entropy.ControlUniqueIds.Count, 0);
}

[DataTestMethod]
[TestMethod]
[DataRow("AppWithLabel.msapp")]
public void TestControlIdIntParsing(string filename)
{
Expand All @@ -68,7 +68,7 @@ public void TestControlIdIntParsing(string filename)

// Validate that the control template fields OverridaleProperties and PCFDynamicSchemaForIRRetrieval are stored in entropy while unpacking
// The test app contains control instances with same template but different fields
[DataTestMethod]
[TestMethod]
[DataRow("ControlInstancesWithDifferentTemplateFields.msapp")]
public void TestControlInstancesWithSameTemplateDifferentFields(string appName)
{
Expand All @@ -82,7 +82,7 @@ public void TestControlInstancesWithSameTemplateDifferentFields(string appName)
Assert.IsTrue(msapp._entropy.PCFDynamicSchemaForIRRetrievalEntry.Count > 0);
}

[DataTestMethod]
[TestMethod]
[DataRow("AnimationControlIdIsGuid.msapp")]
public void TestGetResourcesJSONIndicesKeyNullException(string filename)
{
Expand All @@ -100,7 +100,7 @@ public void TestGetResourcesJSONIndicesKeyNullException(string filename)

// Validate that the pcf control template is stored in entropy while unpacking
// The test app contains control instances with same template but different fields
[DataTestMethod]
[TestMethod]
[DataRow("PcfTemplates.msapp")]
public void TestPCFControlInstancesWithSameTemplateDifferentFields(string appName)
{
Expand All @@ -113,7 +113,7 @@ public void TestPCFControlInstancesWithSameTemplateDifferentFields(string appNam
Assert.IsTrue(msapp._entropy.PCFTemplateEntry.Count > 0);
}

[DataTestMethod]
[TestMethod]
[DataRow("AnimationControlIdIsGuid.msapp")]
public void TestAppWithNoPCFControlInstances(string appName)
{
Expand All @@ -128,7 +128,7 @@ public void TestAppWithNoPCFControlInstances(string appName)

// Validate that a PCF control will still resolve its template by falling back to
// the template store if the control's specific template isn't in Entropy.
[DataTestMethod]
[TestMethod]
[DataRow("PcfTemplates.msapp")]
public void TestPCFControlWillFallBackToControlTemplate(string appName)
{
Expand Down
2 changes: 1 addition & 1 deletion src/PAModelTests/JsonNormalizerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void Test()
}

// String escaping normalizing. \u is an escape, Multiple ways to encode the same char.
[DataTestMethod]
[TestMethod]
[DataRow("\"a\\\"bc\"")]
[DataRow("\"a\\u0022bc\"")]
public void StringEncoding(string unescaped)
Expand Down
6 changes: 3 additions & 3 deletions src/PAModelTests/NameCollisionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public void TestAssetFileRename()
Assert.IsTrue(newFileNames.Contains("image_2"));
}

[DataTestMethod]
[TestMethod]
[DataRow("AppWithLabel.msapp")]
[DataRow("DuplicateScreen.msapp")]
public void TestScreenRename(string appName)
Expand Down Expand Up @@ -115,7 +115,7 @@ public void TestScreenRename(string appName)
}
}

[DataTestMethod]
[TestMethod]
[DataRow("AppWithLabel.msapp")]
[DataRow("DuplicateScreen.msapp")]
[DataRow("ComponentNameCollision.msapp")]
Expand Down Expand Up @@ -205,7 +205,7 @@ public void TestAssetPathCollision()
Assert.IsFalse(errorContainer.HasErrors);
}

[DataTestMethod]
[TestMethod]
[DataRow("CollidingFilenames.msapp")]
public void TestDataSourceNameCollision(string appName)
{
Expand Down
4 changes: 2 additions & 2 deletions src/PAModelTests/ParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace PAModelTests;
[TestClass]
public class ParserTests
{
[DataTestMethod]
[TestMethod]
[DataRow("Foo", true, "Foo", 3)]
[DataRow("'Foo'", true, "Foo", 5)]
[DataRow("'Foo Bar'", true, "Foo Bar", 9)]
Expand All @@ -26,7 +26,7 @@ public void TestParseIdent(string input, bool shouldParse, string output, int ex
Assert.AreEqual(expectedLength, length);
}

[DataTestMethod]
[TestMethod]
[DataRow("Foo As Bar", true, "Foo", "Bar", null)]
[DataRow("Foo As Bar.Baz", true, "Foo", "Bar", "Baz")]
[DataRow("'escaped foo' As Bar", true, "escaped foo", "Bar", null)]
Expand Down
2 changes: 1 addition & 1 deletion src/PAModelTests/ReadTransformTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace PAModelTests;
[TestClass]
public class ReadTransformTests
{
[DataTestMethod]
[TestMethod]
[DataRow("GalleryTemplateNullChildren.msapp", false, false)]
[DataRow("TestStepWithInvalidScreen.msapp", false, true)]
[DataRow("GroupControlStateEmpty.msapp", false, true)]
Expand Down
2 changes: 1 addition & 1 deletion src/PAModelTests/SourceDecoderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class SourceDecoderTests
// Compare actual source output. This catches things like:
// - are we removing default properties, from both Theme Json and Template xmL?
// - canonical ordering and stable output
[DataTestMethod]
[TestMethod]
[DataRow("MyWeather.msapp", "", "Screen1.fx.yaml", "Weather_Screen1.fx.yaml")]
[DataRow("GroupControlTest.msapp", "", "Screen1.fx.yaml", "GroupControl_Test.fx.yaml")]
[DataRow("GalleryTestApp.msapp", "", "Screen1.fx.yaml", "Gallery_ScreenTest.fx.yaml")]
Expand Down
4 changes: 2 additions & 2 deletions src/PAModelTests/TemplateStoreTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class TemplateStoreTests
{
// Validate that the host control template hostType value is stored in entropy while unpacking
// This example app has different host control instances with different template values like HostType
[DataTestMethod]
[TestMethod]
[DataRow("SharepointAppWithHostControls.msapp")]
public void TestHostControlInstancesWithHostType(string appName)
{
Expand Down Expand Up @@ -48,7 +48,7 @@ public void TestHostControlInstancesWithHostType(string appName)
// Validate a modern control that has a dynamic template.
// The template has a valid template name, but makes reference to another template.
// This example app has two modern controls (combobox and dropdown) that make reference to the same template.
[DataTestMethod]
[TestMethod]
[DataRow("ComboboxDropdown.msapp")]
public void TestModernControlWithDynamicTemplate(string appName)
{
Expand Down
8 changes: 4 additions & 4 deletions src/PAModelTests/UtilityTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace PAModelTests;
[TestClass]
public class UtilityTests
{
[DataTestMethod]
[TestMethod]
[DataRow("\r\t!$^%/\\", "%0d%09%21%24%5e%25%2f%5c")]
[DataRow("одиндваодиндваодиндваодиндваодиндваодинд", "одиндваодиндваодиндваодиндваодиндваодинд")]
[DataRow("İkşzlerAçık芲偁ABC巢für नमस्ते กุ้งจิ้яЧчŠš������ - Copy (2).jpg", "İkşzlerA%e7ık芲偁ABC巢f%fcr नमस्ते กุ้งจิ้яЧчŠš������ - Copy %282%29.jpg")]
Expand All @@ -19,7 +19,7 @@ public void TestEscaping(string unescaped, string escaped)
Assert.AreEqual(FilePath.UnEscapeFilename(escaped), unescaped);
}

[DataTestMethod]
[TestMethod]
[DataRow("foo-%41", "foo-A")]
[DataRow("[]_' ", "[]_' ")] // unescape only touches % character.
[DataRow("İkşzlerA%e7ık芲偁ABC巢f%fcr नमस्ते กุ้งจิ้яЧчŠš������ - Copy %282%29.jpg", "İkşzlerAçık芲偁ABC巢für नमस्ते กุ้งจิ้яЧчŠš������ - Copy (2).jpg")]
Expand All @@ -36,7 +36,7 @@ public void TestNotEscaped()
Assert.AreEqual(FilePath.EscapeFilename(a), a);
}

[DataTestMethod]
[TestMethod]
[DataRow("C:\\Foo\\Bar\\file", "C:\\Foo", "Bar\\file")]
[DataRow("C:\\Foo\\Bar\\file", "C:\\Foo\\", "Bar\\file")]
[DataRow("C:\\Foo\\Bar.msapp", "C:\\Foo", "Bar.msapp")]
Expand Down Expand Up @@ -74,7 +74,7 @@ public void Regression153()
Assert.AreEqual(path, original);
}

[DataTestMethod]
[TestMethod]
[DataRow("Long*Control*Name*Truncation*Tests***", "Long%2aControl%2aName%2aTruncation%2aTests%2a_959")]
[DataRow("TestReallyLoooooooooooooooooooooooooooooooooooongControlName", "TestReallyLooooooooooooooooooooooooooooooooooo_cad")]
[DataRow("TestControlName", "TestControlName")]
Expand Down
Loading
Loading