Skip to content

Commit fa4e495

Browse files
.NET 10
1 parent 481d93e commit fa4e495

13 files changed

+229
-231
lines changed

src/RapidCMS.Core.Tests/Forms/EditContextCustomValidationConfigurationTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ public async Task WhenInvalidEntityIsValidated_ThenIsValidShouldReturnFalseAsync
4141

4242
// assert
4343
Assert.That(await _subject.IsValidAsync(), Is.False);
44-
Assert.That(await _subject.IsValidAsync(), Is.False);
45-
Assert.AreEqual("Id is null", _subject.GetPropertyState("Id").GetValidationMessages().First());
44+
Assert.That(_subject.GetPropertyState("Id").GetValidationMessages().First(), Is.EqualTo("Id is null"));
4645
}
4746

4847
[Test]
@@ -69,7 +68,7 @@ public async Task WhenValidEntityIsValidated_ThenIsValidShouldReturnTrueAsync()
6968
_subject.NotifyPropertyIncludedInForm(PropertyMetadataHelper.GetPropertyMetadata<Entity, string>(x => x.Id));
7069

7170
// assert
72-
Assert.IsTrue(await _subject.IsValidAsync());
71+
Assert.That(await _subject.IsValidAsync(), Is.True);
7372
}
7473

7574
public class Entity : IEntity

src/RapidCMS.Core.Tests/Forms/EditContextCustomValidationTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public async Task WhenInvalidEntityIsValidated_ThenIsValidShouldReturnFalseAsync
4141

4242
// assert
4343
Assert.That(await _subject.IsValidAsync(), Is.False);
44-
Assert.AreEqual("Id is null", _subject.GetPropertyState("Id").GetValidationMessages().First());
44+
Assert.That(_subject.GetPropertyState("Id").GetValidationMessages().First(), Is.EqualTo("Id is null"));
4545
}
4646

4747
[Test]
@@ -68,7 +68,7 @@ public async Task WhenValidEntityIsValidated_ThenIsValidShouldReturnTrueAsync()
6868
_subject.NotifyPropertyIncludedInForm(PropertyMetadataHelper.GetPropertyMetadata<Entity, string>(x => x.Id));
6969

7070
// assert
71-
Assert.IsTrue(await _subject.IsValidAsync());
71+
Assert.That(await _subject.IsValidAsync(), Is.True);
7272
}
7373

7474
public class Entity : IEntity

src/RapidCMS.Core.Tests/Forms/EditContextCustomValidationVariantsTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public async Task WhenInvalidEntityIsValidated_ThenIsValidShouldReturnFalseAsync
4545

4646
// assert
4747
Assert.That(await _subject.IsValidAsync(), Is.False);
48-
Assert.AreEqual("Id is null", _subject.GetPropertyState("Id").GetValidationMessages().First());
48+
Assert.That(_subject.GetPropertyState("Id").GetValidationMessages().First(), Is.EqualTo("Id is null"));
4949
}
5050

5151
[Test]
@@ -74,7 +74,7 @@ public async Task WhenInvalidEntityVariantAIsValidated_ThenIsValidShouldReturnFa
7474

7575
// assert
7676
Assert.That(await _subject.IsValidAsync(), Is.False);
77-
Assert.AreEqual("Id of A-variant cannot be A", _subject.GetPropertyState("Id").GetValidationMessages().First());
77+
Assert.That(_subject.GetPropertyState("Id").GetValidationMessages().First(), Is.EqualTo("Id of A-variant cannot be A"));
7878
}
7979

8080
[Test]
@@ -103,7 +103,7 @@ public async Task WhenInvalidEntityVariantBIsValidated_ThenIsValidShouldReturnFa
103103

104104
// assert
105105
Assert.That(await _subject.IsValidAsync(), Is.False);
106-
Assert.AreEqual("Id of B-variant cannot be B", _subject.GetPropertyState("Id").GetValidationMessages().First());
106+
Assert.That(_subject.GetPropertyState("Id").GetValidationMessages().First(), Is.EqualTo("Id of B-variant cannot be B"));
107107
}
108108

109109
[Test]
@@ -134,7 +134,7 @@ public async Task WhenValidEntityIsValidated_ThenIsValidShouldReturnTrueAsync()
134134
_subject.NotifyPropertyIncludedInForm(PropertyMetadataHelper.GetPropertyMetadata<Entity, string>(x => x.Id));
135135

136136
// assert
137-
Assert.IsTrue(await _subject.IsValidAsync());
137+
Assert.That(await _subject.IsValidAsync(), Is.True);
138138
}
139139

140140
[Test]
@@ -162,7 +162,7 @@ public async Task WhenValidEntityVariantAIsValidated_ThenIsValidShouldReturnTrue
162162
_subject.NotifyPropertyIncludedInForm(PropertyMetadataHelper.GetPropertyMetadata<Entity, string>(x => x.Id));
163163

164164
// assert
165-
Assert.IsTrue(await _subject.IsValidAsync());
165+
Assert.That(await _subject.IsValidAsync(), Is.True);
166166
}
167167

168168
[Test]
@@ -190,7 +190,7 @@ public async Task WhenValidEntityVariantBIsValidated_ThenIsValidShouldReturnTrue
190190
_subject.NotifyPropertyIncludedInForm(PropertyMetadataHelper.GetPropertyMetadata<Entity, string>(x => x.Id));
191191

192192
// assert
193-
Assert.IsTrue(await _subject.IsValidAsync());
193+
Assert.That(await _subject.IsValidAsync(), Is.True);
194194
}
195195

196196
public class Entity : IEntity

src/RapidCMS.Core.Tests/Forms/EditContextTests.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public async Task WhenPropertyIsModifiedViaMetadata_ThenFieldEventIsTriggeredAsy
5050
await _subject.NotifyPropertyChangedAsync(_property);
5151

5252
// assert
53-
Assert.IsTrue(called);
53+
Assert.That(called, Is.True);
5454
}
5555

5656
[Test]
@@ -64,7 +64,7 @@ public void WhenPropertyIsBusyViaMetadata_ThenValidationStateEventIsTriggered()
6464
_subject.NotifyPropertyBusy(_property);
6565

6666
// assert
67-
Assert.IsTrue(called);
67+
Assert.That(called, Is.True);
6868
}
6969

7070
[Test]
@@ -78,7 +78,7 @@ public void WhenPropertyIsFinishedViaMetadata_ThenValidationStateEventIsTriggere
7878
_subject.NotifyPropertyFinished(_property);
7979

8080
// assert
81-
Assert.IsTrue(called);
81+
Assert.That(called, Is.True);
8282
}
8383

8484
[Test]
@@ -96,7 +96,7 @@ public async Task WhenEntityIsInvalidButNotTouched_ThenEditContextIsValidAsync()
9696
_serviceCollection.BuildServiceProvider());
9797

9898
// act & assert
99-
Assert.IsTrue(await _subject.IsValidAsync());
99+
Assert.That(await _subject.IsValidAsync(), Is.True);
100100
}
101101

102102
[Test]
@@ -135,7 +135,7 @@ public async Task WhenEntityIsValidAndTouched_ThenEditContextIsValidAsync()
135135
await _subject.NotifyPropertyChangedAsync(_property);
136136

137137
// act & assert
138-
Assert.IsTrue(await _subject.IsValidAsync());
138+
Assert.That(await _subject.IsValidAsync(), Is.True);
139139
}
140140

141141
[Test]
@@ -153,7 +153,7 @@ public void WhenPropertyIsInvalidButNotTouched_ThenEditContextIsValid()
153153
_serviceCollection.BuildServiceProvider());
154154

155155
// act & assert
156-
Assert.IsTrue(_subject.IsValid(_property));
156+
Assert.That(_subject.IsValid(_property), Is.True);
157157
}
158158

159159
[Test]
@@ -192,7 +192,7 @@ public void WhenPropertyIsValidAndTouched_ThenEditContextIsValid()
192192
_subject.NotifyPropertyIncludedInForm(_property);
193193

194194
// act & assert
195-
Assert.IsTrue(_subject.IsValid(_property));
195+
Assert.That(_subject.IsValid(_property), Is.True);
196196
}
197197

198198
[Test]
@@ -209,7 +209,7 @@ public async Task WhenEntityIsTouched_ThenEditContextIsModifiedAsync()
209209
await _subject.NotifyPropertyChangedAsync(_property);
210210

211211
// act & assert
212-
Assert.IsTrue(_subject.IsModified());
212+
Assert.That(_subject.IsModified(), Is.True);
213213
}
214214

215215
[Test]
@@ -226,7 +226,7 @@ public async Task WhenPropertyIsTouched_ThenPropertyIsValidatedAsync()
226226
await _subject.NotifyPropertyChangedAsync(_property);
227227

228228
// act & assert
229-
Assert.IsTrue(_subject.WasValidated(_property));
229+
Assert.That(_subject.WasValidated(_property), Is.True);
230230
}
231231

232232
[Test]
@@ -236,7 +236,7 @@ public void WhenValidationMessageIsAddedToProperty_ThenPropertyIsInvalid()
236236
_subject.AddValidationMessage(_property, "Error");
237237

238238
// assert
239-
Assert.IsTrue(_subject.WasValidated(_property));
239+
Assert.That(_subject.WasValidated(_property), Is.True);
240240
Assert.That(_subject.IsValid(_property), Is.False);
241241
}
242242

@@ -247,7 +247,7 @@ public void WhenValidationMessageIsAddedToProperty_ThenPropertyHasValidationMess
247247
_subject.AddValidationMessage(_property, "Error");
248248

249249
// assert
250-
Assert.AreEqual("Error", _subject.GetValidationMessages(_property).First());
250+
Assert.That(_subject.GetValidationMessages(_property).First(), Is.EqualTo("Error"));
251251
}
252252

253253
[Test]
@@ -257,7 +257,7 @@ public async Task WhenNestedPropertyIsTouched_ThenPropertyIsValidatedAsync()
257257
await _subject.NotifyPropertyChangedAsync(_nestedProperty);
258258

259259
// assert
260-
Assert.IsTrue(_subject.WasValidated(_nestedProperty));
260+
Assert.That(_subject.WasValidated(_nestedProperty), Is.True);
261261
Assert.That(_subject.IsValid(_nestedProperty), Is.False);
262262
}
263263

@@ -279,16 +279,16 @@ public async Task WhenNestedPropertyIsTouchedAndValid_ThenPropertyIsValidatedAnd
279279
await _subject.NotifyPropertyChangedAsync(_nestedProperty);
280280

281281
// assert
282-
Assert.IsTrue(_subject.WasValidated(_nestedProperty));
283-
Assert.IsTrue(_subject.IsValid(_nestedProperty));
282+
Assert.That(_subject.WasValidated(_nestedProperty), Is.True);
283+
Assert.That(_subject.IsValid(_nestedProperty), Is.True);
284284
}
285285

286286
[Test]
287287
public void WhenNestedPropertyIsNotTouched_ThenPropertyIsNotValidated()
288288
{
289289
// assert
290290
Assert.That(_subject.WasValidated(_nestedProperty), Is.False);
291-
Assert.IsTrue(_subject.IsValid(_nestedProperty));
291+
Assert.That(_subject.IsValid(_nestedProperty), Is.True);
292292
}
293293

294294
private readonly Expression<Func<Entity, string>> _getId = x => x.Id;

src/RapidCMS.Core.Tests/Interactions/ButtonInteractionHandlerTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void WhenValidationOfEditorButtonIsRequested_ThenValidityOfEditContextIsT
9393

9494
// assert
9595
_buttonActionHandler.Verify(x => x.RequiresValidForm(It.IsAny<ButtonSetup>(), It.IsAny<FormEditContext>()), Times.Once());
96-
Assert.AreEqual(requiresTesting, editContext.WasValidated(PropertyMetadataHelper.GetPropertyMetadata(property)!));
96+
Assert.That(editContext.WasValidated(PropertyMetadataHelper.GetPropertyMetadata(property)!), Is.EqualTo(requiresTesting));
9797
}
9898

9999
[Test]
@@ -177,7 +177,7 @@ public void WhenValidationOfEditorInListButtonIsRequested_ThenValidityOfEditCont
177177

178178
// assert
179179
_buttonActionHandler.Verify(x => x.RequiresValidForm(It.IsAny<ButtonSetup>(), It.IsAny<FormEditContext>()), Times.Once());
180-
Assert.AreEqual(requiresTesting, editContext.WasValidated(PropertyMetadataHelper.GetPropertyMetadata(property)!));
180+
Assert.That(editContext.WasValidated(PropertyMetadataHelper.GetPropertyMetadata(property)!), Is.EqualTo(requiresTesting));
181181
}
182182

183183
[Test]

src/RapidCMS.Core.Tests/JsonConverters/EntityModelJsonConverter.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ public void WhenEntityIsGivenToJsonConverter_EntityIsDeserialized()
2626

2727
var deserializedModel = JsonConvert.DeserializeObject<EntityModel<Entity>>(json, _jsonSerializerSettings);
2828

29-
Assert.AreEqual(model.Entity.GetType(), deserializedModel.Entity.GetType());
30-
Assert.AreEqual(model.VariantAlias, deserializedModel.VariantAlias);
29+
Assert.That(deserializedModel.Entity.GetType(), Is.EqualTo(model.Entity.GetType()));
30+
Assert.That(deserializedModel.VariantAlias, Is.EqualTo(model.VariantAlias));
3131
}
3232

3333
[Test]
@@ -39,8 +39,8 @@ public void WhenSubEntityIsGivenToJsonConverter_SubEntityIsDeserialized()
3939

4040
var deserializedModel = JsonConvert.DeserializeObject<EntityModel<Entity>>(json, _jsonSerializerSettings);
4141

42-
Assert.AreEqual(model.Entity.GetType(), deserializedModel.Entity.GetType());
43-
Assert.AreEqual(model.VariantAlias, deserializedModel.VariantAlias);
42+
Assert.That(deserializedModel.Entity.GetType(), Is.EqualTo(model.Entity.GetType()));
43+
Assert.That(deserializedModel.VariantAlias, Is.EqualTo(model.VariantAlias));
4444
}
4545

4646
class Entity : IEntity

src/RapidCMS.Core.Tests/Navigation/NavigationStateTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public void WhenUrlIsGiven_ThenUrlIsParsed(string url, string query, NavigationS
1313
{
1414
var state = new NavigationState(url, query);
1515

16-
Assert.IsTrue(expectedState.Equals(state));
16+
Assert.That(expectedState.Equals(state), Is.True);
1717
}
1818

1919
private class NavigationStateTestCases : IEnumerable

src/RapidCMS.Core.Tests/ParentPathTests/ParentEntityPathTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public void BasicPath()
2121
var path = parent.GetParentPath();
2222

2323
// assert
24-
Assert.AreEqual("test1:1", path!.ToPathString());
24+
Assert.That(path!.ToPathString(), Is.EqualTo("test1:1"));
2525
}
2626

2727
[Test]
@@ -36,7 +36,7 @@ public void NestedPath()
3636
var path = parent.GetParentPath();
3737

3838
// assert
39-
Assert.AreEqual("test2:2;test1:1", path!.ToPathString());
39+
Assert.That(path!.ToPathString(), Is.EqualTo("test2:2;test1:1"));
4040
}
4141

4242
[Test]
@@ -53,7 +53,7 @@ public void DeepNestedPath()
5353
var path = parent.GetParentPath();
5454

5555
// assert
56-
Assert.AreEqual("test3:3;test2:2;test1:1", path!.ToPathString());
56+
Assert.That(path!.ToPathString(), Is.EqualTo("test3:3;test2:2;test1:1"));
5757
}
5858

5959
public class Entity : IEntity

src/RapidCMS.Core.Tests/ParentPathTests/ParentPathTests.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public void BasicPath()
1919
var path = ParentPath.TryParse("test:123");
2020

2121
// assert
22-
Assert.AreEqual("test:123", path!.ToPathString());
22+
Assert.That(path!.ToPathString(), Is.EqualTo("test:123"));
2323
}
2424

2525
[Test]
@@ -32,8 +32,8 @@ public void AppendPath()
3232
var newPath = ParentPath.AddLevel(path, "test2", "1234");
3333

3434
// assert
35-
Assert.AreEqual("test:123", path!.ToPathString());
36-
Assert.AreEqual("test:123;test2:1234", newPath.ToPathString());
35+
Assert.That(path!.ToPathString(), Is.EqualTo("test:123"));
36+
Assert.That(newPath.ToPathString(), Is.EqualTo("test:123;test2:1234"));
3737
}
3838

3939
[Test]
@@ -46,7 +46,7 @@ public void AppendPathFromNull()
4646
var newPath = ParentPath.AddLevel(path, "test2", "1234");
4747

4848
// assert
49-
Assert.AreEqual("test2:1234", newPath.ToPathString());
49+
Assert.That(newPath.ToPathString(), Is.EqualTo("test2:1234"));
5050
}
5151

5252
[Test]
@@ -59,10 +59,10 @@ public void RemoveLevel()
5959
var (newPath, collectionAlias, id) = ParentPath.RemoveLevel(path);
6060

6161
// assert
62-
Assert.AreEqual("test:123;test2:1234", path!.ToPathString());
63-
Assert.AreEqual("test:123", newPath.ToPathString());
64-
Assert.AreEqual("test2", collectionAlias);
65-
Assert.AreEqual("1234", id);
62+
Assert.That(path!.ToPathString(), Is.EqualTo("test:123;test2:1234"));
63+
Assert.That(newPath.ToPathString(), Is.EqualTo("test:123"));
64+
Assert.That(collectionAlias, Is.EqualTo("test2"));
65+
Assert.That(id, Is.EqualTo("1234"));
6666
}
6767

6868
[Test]
@@ -76,10 +76,10 @@ public void RemoveLevelRemoveLevel()
7676
var (newPath, collectionAlias, id) = ParentPath.RemoveLevel(intPath);
7777

7878
// assert
79-
Assert.AreEqual("test:123;test2:1234", path!.ToPathString());
80-
Assert.AreEqual(null, newPath);
81-
Assert.AreEqual("test", collectionAlias);
82-
Assert.AreEqual("123", id);
79+
Assert.That(path!.ToPathString(), Is.EqualTo("test:123;test2:1234"));
80+
Assert.That(newPath, Is.EqualTo(null));
81+
Assert.That(collectionAlias, Is.EqualTo("test"));
82+
Assert.That(id, Is.EqualTo("123"));
8383
}
8484

8585
[Test]
@@ -92,9 +92,9 @@ public void RemoveLevelFromNull()
9292
var (newPath, collectionAlias, id) = ParentPath.RemoveLevel(path);
9393

9494
// assert
95-
Assert.AreEqual(null, path?.ToPathString());
96-
Assert.AreEqual("", newPath?.ToPathString());
97-
Assert.AreEqual(null, collectionAlias);
98-
Assert.AreEqual(null, id);
95+
Assert.That(path?.ToPathString(), Is.EqualTo(null));
96+
Assert.That(newPath?.ToPathString(), Is.EqualTo(""));
97+
Assert.That(collectionAlias, Is.EqualTo(null));
98+
Assert.That(id, Is.EqualTo(null));
9999
}
100100
}

0 commit comments

Comments
 (0)