Skip to content
Merged
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
3 changes: 3 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
"sdk": {
"version": "8.0.417",
"rollForward": "latestMinor"
},
"msbuild-sdks": {
"MSTest.Sdk": "4.0.2"
}
}
13 changes: 2 additions & 11 deletions samples/Test.AppWriter/Test.AppWriter.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<Project Sdk="MSTest.Sdk">
<!-- https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-mstest-sdk -->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<!-- TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net8.0-windows10.0.19041.0</TargetFrameworks -->
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<Optimize>False</Optimize>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
</PropertyGroup>

Expand Down
4 changes: 4 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
<ChecksumAlgorithm>SHA256</ChecksumAlgorithm>
</PropertyGroup>

<PropertyGroup Label="MSTest.Sdk project defaults">
<TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
</PropertyGroup>

<PropertyGroup Label="Versioning" Condition="!Exists('$(PipelineVersionAssemblyInfoFilePath)')">
<VersionPrefix Condition="'$(VersionPrefix)' == ''">0.1.0</VersionPrefix>
<VersionSuffix Condition="'$(VersionSuffix)' == ''">dev</VersionSuffix>
Expand Down
43 changes: 20 additions & 23 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,29 +1,26 @@
<Project>
<!-- See: https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management -->
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<!-- See: https://learn.microsoft.com/en-us/nuget/consume-packages/central-package-management -->
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>

<ItemGroup>
<PackageVersion Include="coverlet.collector" Version="6.0.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="JsonSchema.Net" Version="7.1.2" />
<ItemGroup>
<PackageVersion Include="FluentAssertions" Version="7.2.0" />
<PackageVersion Include="JsonSchema.Net" Version="7.1.2" />

<!-- WARNING: Do not update Moq library past 4.20.0 due to privacy issues: https://github.com/devlooped/moq/issues/1372 -->
<PackageVersion Include="Moq" Version="4.16.0" />
<!-- WARNING: Do not update Moq library past 4.20.0 due to privacy issues: https://github.com/devlooped/moq/issues/1372
<PackageVersion Include="Moq" Version="4.16.0" />-->

<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" />
<PackageVersion Include="MSTest" Version="3.2.2" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.2.2" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<!-- System.Text.Json is a transitive dependency of Yaml2JsonNode for netstandard2.0. Pinning to 8.0.5 for CVE-2024-43485, but can be removed on update of Yaml2JsonNode -->
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
<PackageVersion Include="System.Text.Encodings.Web" Version="8.0.0" />
<PackageVersion Include="Yaml2JsonNode" Version="2.1.1" />
<PackageVersion Include="YamlDotNet" Version="15.1.6" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.3" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<!-- System.Text.Json is a transitive dependency of Yaml2JsonNode for netstandard2.0. Pinning to 8.0.5 for CVE-2024-43485, but can be removed on update of Yaml2JsonNode -->
<PackageVersion Include="System.Text.Json" Version="8.0.5" />
<PackageVersion Include="System.Text.Encodings.Web" Version="8.0.0" />
<PackageVersion Include="Yaml2JsonNode" Version="2.1.1" />
<PackageVersion Include="YamlDotNet" Version="15.1.6" />

</ItemGroup>
</ItemGroup>
</Project>
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
8 changes: 4 additions & 4 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 @@ -21,15 +21,15 @@ public void TestChecksum(string filename, string expectedChecksum, int expectedF
var actualChecksum = ChecksumMaker.GetChecksum(root);

Assert.AreEqual(expectedChecksum, actualChecksum.wholeChecksum);
Assert.AreEqual(expectedFileCount, actualChecksum.perFileChecksum.Count);
Assert.HasCount(expectedFileCount, actualChecksum.perFileChecksum);
Assert.IsTrue(actualChecksum.perFileChecksum.TryGetValue(file, out var perFileChecksum));
Assert.AreEqual(innerExpectedChecksum, perFileChecksum);

// Test checksum version
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
32 changes: 16 additions & 16 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 @@ -66,7 +66,7 @@ public void TestTableDefinitionsAreLastEntriesWhenEntropyDeleted(string appName)
{
var dataSourcesFromMsapp = ToObject<DataSourcesJson>(entry);
var last = dataSourcesFromMsapp.DataSources.LastOrDefault();
Assert.AreEqual(last.TableDefinition != null, true);
Assert.IsNotNull(last.TableDefinition);
return;
}
default:
Expand All @@ -78,7 +78,7 @@ public void TestTableDefinitionsAreLastEntriesWhenEntropyDeleted(string appName)
}
}

[DataTestMethod]
[TestMethod]
[DataRow("EmptyLocalDBRefsHashMismatchProperties.msapp")]
public void TestNoLocalDatabaseRefsWhenLocalDatabaseReferencesPropertyWasEmptyJson(string appName)
{
Expand All @@ -95,10 +95,10 @@ public void TestNoLocalDatabaseRefsWhenLocalDatabaseReferencesPropertyWasEmptyJs
var loadedMsApp = SourceSerializer.LoadFromSource(sourcesTempDirPath, new ErrorContainer());
Assert.IsTrue(loadedMsApp._entropy.WasLocalDatabaseReferencesEmpty.Value);
Assert.IsFalse(loadedMsApp._entropy.LocalDatabaseReferencesAsEmpty);
Assert.IsTrue(loadedMsApp._dataSourceReferences.Count == 0);
Assert.IsEmpty(loadedMsApp._dataSourceReferences);
}

[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 All @@ -137,22 +137,22 @@ public void TestUnusedDataSourcesArePreserved(string appName)
Assert.AreEqual(msApp._dataSourceReferences.First().Key, msApp._dataSourceReferences.First().Key);
var actualDataSources = msApp1._dataSourceReferences.First().Value.dataSources;
var expectedDataSources = msApp._dataSourceReferences.First().Value.dataSources;
Assert.AreEqual(expectedDataSources.Count, actualDataSources.Count);
Assert.HasCount(expectedDataSources.Count, actualDataSources);
Assert.IsTrue(actualDataSources.ContainsKey("environment_39a902ba"));
foreach (var kvp in actualDataSources)
{
Assert.IsTrue(expectedDataSources.ContainsKey(kvp.Key));
var expectedDataSource = expectedDataSources[kvp.Key];
var actualDataSource = kvp.Value;
Assert.AreEqual(expectedDataSource.ExtensionData.Count, actualDataSource.ExtensionData.Count);
Assert.HasCount(expectedDataSource.ExtensionData.Count, actualDataSource.ExtensionData);
foreach (var kvpExtension in actualDataSource.ExtensionData)
{
Assert.IsTrue(expectedDataSource.ExtensionData.ContainsKey(kvpExtension.Key));
}
}
}

[DataTestMethod]
[TestMethod]
[DataRow("MultipleDataSourcesWithOneUnused.msapp")]
public void TestUnusedDataSourcesAreNotPreservedWhenNotTracked(string appName)
{
Expand All @@ -173,7 +173,7 @@ public void TestUnusedDataSourcesAreNotPreservedWhenNotTracked(string appName)
errors1.ThrowOnErrors();

var actualDataSources = msApp1._dataSourceReferences.First().Value.dataSources;
Assert.AreEqual(expectedDataSources.Count - actualDataSources.Count, 1);
Assert.AreEqual(1, expectedDataSources.Count - actualDataSources.Count);
foreach (var key in expectedDataSources.Keys)
{
if (key == "environment_39a902ba")
Expand All @@ -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 @@ -235,10 +235,10 @@ public void TestWhenDataSourcesIsSetToEmptyDictionary(string appName)
errors = msApp.SaveToSources(sources2.Dir, msAppTemp.FullPath);
errors.ThrowOnErrors();

Assert.AreEqual(msApp._dataSourceReferences.First().Value.dataSources.Count, 0);
Assert.IsEmpty(msApp._dataSourceReferences.First().Value.dataSources);
}

[DataTestMethod]
[TestMethod]
[DataRow("NoUnusedDataSources.msapp")]
public void TestAllUsedDataSourcesArePreserved(string appName)
{
Expand All @@ -255,14 +255,14 @@ public void TestAllUsedDataSourcesArePreserved(string appName)
var (msApp1, errors1) = CanvasDocument.LoadFromSources(sourcesDir.Dir);
errors1.ThrowOnErrors();

Assert.AreEqual(msApp._dataSourceReferences["default.cds"].dataSources.Count, msApp._dataSourceReferences["default.cds"].dataSources.Count);
Assert.HasCount(msApp._dataSourceReferences["default.cds"].dataSources.Count, msApp._dataSourceReferences["default.cds"].dataSources);
foreach (var entry in msApp._dataSourceReferences["default.cds"].dataSources.Keys.OrderBy(key => key).Zip(msApp1._dataSourceReferences["default.cds"].dataSources.Keys.OrderBy(key => key)))
{
Assert.AreEqual(entry.First, entry.Second);
}
}

[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
2 changes: 1 addition & 1 deletion src/PAModelTests/DefaultValuesTransformTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public void TestCaseWithNullDynamicProperties()
}

// nodeProperties after BeforeWrite() contains only the SomeProp and none of the null dynamic properties
Assert.IsTrue(nodeProperties.Count == 1);
Assert.HasCount(1, nodeProperties);
}

private static EditorStateStore getEditorStateStore()
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
Loading