Skip to content

Commit 4174ef1

Browse files
committed
Update to Sdk 4.0.2
1 parent 12764fc commit 4174ef1

12 files changed

Lines changed: 36 additions & 32 deletions

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44
"rollForward": "latestMinor"
55
},
66
"msbuild-sdks": {
7-
"MSTest.Sdk": "3.11.1"
7+
"MSTest.Sdk": "4.0.2"
88
}
99
}

src/PAModelTests/ChecksumTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void TestChecksum(string filename, string expectedChecksum, int expectedF
2121
var actualChecksum = ChecksumMaker.GetChecksum(root);
2222

2323
Assert.AreEqual(expectedChecksum, actualChecksum.wholeChecksum);
24-
Assert.AreEqual(expectedFileCount, actualChecksum.perFileChecksum.Count);
24+
Assert.HasCount(expectedFileCount, actualChecksum.perFileChecksum);
2525
Assert.IsTrue(actualChecksum.perFileChecksum.TryGetValue(file, out var perFileChecksum));
2626
Assert.AreEqual(innerExpectedChecksum, perFileChecksum);
2727

src/PAModelTests/DataSourceTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void TestTableDefinitionsAreLastEntriesWhenEntropyDeleted(string appName)
6666
{
6767
var dataSourcesFromMsapp = ToObject<DataSourcesJson>(entry);
6868
var last = dataSourcesFromMsapp.DataSources.LastOrDefault();
69-
Assert.AreEqual(last.TableDefinition != null, true);
69+
Assert.IsNotNull(last.TableDefinition);
7070
return;
7171
}
7272
default:
@@ -95,7 +95,7 @@ public void TestNoLocalDatabaseRefsWhenLocalDatabaseReferencesPropertyWasEmptyJs
9595
var loadedMsApp = SourceSerializer.LoadFromSource(sourcesTempDirPath, new ErrorContainer());
9696
Assert.IsTrue(loadedMsApp._entropy.WasLocalDatabaseReferencesEmpty.Value);
9797
Assert.IsFalse(loadedMsApp._entropy.LocalDatabaseReferencesAsEmpty);
98-
Assert.IsTrue(loadedMsApp._dataSourceReferences.Count == 0);
98+
Assert.IsEmpty(loadedMsApp._dataSourceReferences);
9999
}
100100

101101
[TestMethod]
@@ -137,14 +137,14 @@ public void TestUnusedDataSourcesArePreserved(string appName)
137137
Assert.AreEqual(msApp._dataSourceReferences.First().Key, msApp._dataSourceReferences.First().Key);
138138
var actualDataSources = msApp1._dataSourceReferences.First().Value.dataSources;
139139
var expectedDataSources = msApp._dataSourceReferences.First().Value.dataSources;
140-
Assert.AreEqual(expectedDataSources.Count, actualDataSources.Count);
140+
Assert.HasCount(expectedDataSources.Count, actualDataSources);
141141
Assert.IsTrue(actualDataSources.ContainsKey("environment_39a902ba"));
142142
foreach (var kvp in actualDataSources)
143143
{
144144
Assert.IsTrue(expectedDataSources.ContainsKey(kvp.Key));
145145
var expectedDataSource = expectedDataSources[kvp.Key];
146146
var actualDataSource = kvp.Value;
147-
Assert.AreEqual(expectedDataSource.ExtensionData.Count, actualDataSource.ExtensionData.Count);
147+
Assert.HasCount(expectedDataSource.ExtensionData.Count, actualDataSource.ExtensionData);
148148
foreach (var kvpExtension in actualDataSource.ExtensionData)
149149
{
150150
Assert.IsTrue(expectedDataSource.ExtensionData.ContainsKey(kvpExtension.Key));
@@ -173,7 +173,7 @@ public void TestUnusedDataSourcesAreNotPreservedWhenNotTracked(string appName)
173173
errors1.ThrowOnErrors();
174174

175175
var actualDataSources = msApp1._dataSourceReferences.First().Value.dataSources;
176-
Assert.AreEqual(expectedDataSources.Count - actualDataSources.Count, 1);
176+
Assert.AreEqual(1, expectedDataSources.Count - actualDataSources.Count);
177177
foreach (var key in expectedDataSources.Keys)
178178
{
179179
if (key == "environment_39a902ba")
@@ -235,7 +235,7 @@ public void TestWhenDataSourcesIsSetToEmptyDictionary(string appName)
235235
errors = msApp.SaveToSources(sources2.Dir, msAppTemp.FullPath);
236236
errors.ThrowOnErrors();
237237

238-
Assert.AreEqual(msApp._dataSourceReferences.First().Value.dataSources.Count, 0);
238+
Assert.IsEmpty(msApp._dataSourceReferences.First().Value.dataSources);
239239
}
240240

241241
[TestMethod]
@@ -255,7 +255,7 @@ public void TestAllUsedDataSourcesArePreserved(string appName)
255255
var (msApp1, errors1) = CanvasDocument.LoadFromSources(sourcesDir.Dir);
256256
errors1.ThrowOnErrors();
257257

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

src/PAModelTests/DefaultValuesTransformTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void TestCaseWithNullDynamicProperties()
4747
}
4848

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

5353
private static EditorStateStore getEditorStateStore()

src/PAModelTests/EntropyTests.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ public void TestControlIdGuidParsing(string filename)
4848
(var msapp, var errors) = CanvasDocument.LoadFromMsapp(root);
4949
errors.ThrowOnErrors();
5050

51-
Assert.IsTrue(msapp._entropy.ControlUniqueGuids.Count > 0);
52-
Assert.AreEqual(msapp._entropy.ControlUniqueIds.Count, 0);
51+
Assert.IsNotEmpty(msapp._entropy.ControlUniqueGuids);
52+
Assert.IsEmpty(msapp._entropy.ControlUniqueIds);
5353
}
5454

5555
[TestMethod]
@@ -62,8 +62,8 @@ public void TestControlIdIntParsing(string filename)
6262
(var msapp, var errors) = CanvasDocument.LoadFromMsapp(root);
6363
errors.ThrowOnErrors();
6464

65-
Assert.IsTrue(msapp._entropy.ControlUniqueIds.Count > 0);
66-
Assert.AreEqual(msapp._entropy.ControlUniqueGuids.Count, 0);
65+
Assert.IsNotEmpty(msapp._entropy.ControlUniqueIds);
66+
Assert.IsEmpty(msapp._entropy.ControlUniqueGuids);
6767
}
6868

6969
// Validate that the control template fields OverridaleProperties and PCFDynamicSchemaForIRRetrieval are stored in entropy while unpacking
@@ -78,8 +78,8 @@ public void TestControlInstancesWithSameTemplateDifferentFields(string appName)
7878
(var msapp, var errors) = CanvasDocument.LoadFromMsapp(root);
7979
errors.ThrowOnErrors();
8080

81-
Assert.IsTrue(msapp._entropy.OverridablePropertiesEntry.Count > 0);
82-
Assert.IsTrue(msapp._entropy.PCFDynamicSchemaForIRRetrievalEntry.Count > 0);
81+
Assert.IsNotEmpty(msapp._entropy.OverridablePropertiesEntry);
82+
Assert.IsNotEmpty(msapp._entropy.PCFDynamicSchemaForIRRetrievalEntry);
8383
}
8484

8585
[TestMethod]
@@ -110,7 +110,7 @@ public void TestPCFControlInstancesWithSameTemplateDifferentFields(string appNam
110110
(var msapp, var errors) = CanvasDocument.LoadFromMsapp(root);
111111
errors.ThrowOnErrors();
112112

113-
Assert.IsTrue(msapp._entropy.PCFTemplateEntry.Count > 0);
113+
Assert.IsNotEmpty(msapp._entropy.PCFTemplateEntry);
114114
}
115115

116116
[TestMethod]
@@ -123,7 +123,7 @@ public void TestAppWithNoPCFControlInstances(string appName)
123123
(var msapp, var errors) = CanvasDocument.LoadFromMsapp(root);
124124
errors.ThrowOnErrors();
125125

126-
Assert.IsTrue(msapp._entropy.PCFTemplateEntry.Count == 0);
126+
Assert.IsEmpty(msapp._entropy.PCFTemplateEntry);
127127
}
128128

129129
// Validate that a PCF control will still resolve its template by falling back to
@@ -138,11 +138,11 @@ public void TestPCFControlWillFallBackToControlTemplate(string appName)
138138
(var msapp, var errors) = CanvasDocument.LoadFromMsapp(root);
139139
errors.ThrowOnErrors();
140140

141-
Assert.IsTrue(msapp._entropy.PCFTemplateEntry.Count > 0);
141+
Assert.IsNotEmpty(msapp._entropy.PCFTemplateEntry);
142142

143143
// Clear out the PCF templates in entropy
144144
msapp._entropy.PCFTemplateEntry.Clear();
145-
Assert.IsTrue(msapp._entropy.PCFTemplateEntry.Count == 0);
145+
Assert.IsEmpty(msapp._entropy.PCFTemplateEntry);
146146

147147
// Repack the app and validate it matches the initial msapp
148148
using (var tempFile = new TempFile())

src/PAModelTests/NameCollisionTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void TestScreenRename(string appName)
111111
}
112112

113113
// There should be no expected files that were not found
114-
Assert.AreEqual(expectedScreens.Count, 0, $"{expectedScreens.Count} screens not found in Src directory.");
114+
Assert.IsEmpty(expectedScreens, $"{expectedScreens.Count} screens not found in Src directory.");
115115
}
116116
}
117117

@@ -167,7 +167,7 @@ public void TestEditorStateRename(string appName)
167167
}
168168

169169
// There should be no expected files that were not found
170-
Assert.AreEqual(expectedControlsWithEditorState.Count, 0, $"{expectedControlsWithEditorState.Count} editor state files not found in EditorState directory.");
170+
Assert.IsEmpty(expectedControlsWithEditorState, $"{expectedControlsWithEditorState.Count} editor state files not found in EditorState directory.");
171171
}
172172
}
173173

@@ -267,6 +267,6 @@ public void TestAssetFileCollision()
267267
var errorContainer = new ErrorContainer();
268268
doc.StabilizeAssetFilePaths(errorContainer);
269269

270-
Assert.AreEqual(doc._assetFiles.Count(), 2);
270+
Assert.AreEqual(2, doc._assetFiles.Count());
271271
}
272272
}

src/PAModelTests/ReadTransformTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,6 @@ public void TestNullResource()
5050
var errorContainer = new ErrorContainer();
5151
doc.StabilizeAssetFilePaths(errorContainer);
5252

53-
Assert.AreEqual(errorContainer.HasErrors, false);
53+
Assert.IsFalse(errorContainer.HasErrors);
5454
}
5555
}

src/PAModelTests/SmartMergeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ public void ScreenAddTest()
314314
{
315315
resultDoc._screens.TryGetValue("Screen32", out var control);
316316
Assert.AreEqual(1, control.Properties.Count(item => item.Identifier == "SomeProp"));
317-
Assert.IsTrue(resultDoc._screenOrder.Contains("Screen32"));
317+
Assert.Contains("Screen32", resultDoc._screenOrder);
318318
});
319319
}
320320

src/PAModelTests/TemplateParserTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void TestGalleryNestedTemplateParse()
2828
var templateStore = new TemplateStore();
2929
Assert.IsTrue(ControlTemplateParser.TryParseTemplate(templateStore, galleryTemplateContents, AppType.DesktopOrTablet, parsedTemplates, out var topTemplate, out var name));
3030

31-
Assert.AreEqual(2, parsedTemplates.Count);
31+
Assert.HasCount(2, parsedTemplates);
3232
Assert.AreEqual("gallery", name);
3333
Assert.AreEqual("http://microsoft.com/appmagic/gallery", topTemplate.Id);
3434

src/PAModelTests/UtilityTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,6 @@ public void Regression153()
8181
public void TestControlNameTruncation(string originalName, string expectedName)
8282
{
8383
var truncatedName = FilePath.TruncateNameIfTooLong(originalName);
84-
Assert.AreEqual(truncatedName, expectedName);
84+
Assert.AreEqual(expectedName, truncatedName);
8585
}
8686
}

0 commit comments

Comments
 (0)