Skip to content

Commit fbfb605

Browse files
committed
Upgrade FulentAssertions
Migrate to v6 best practices. Use `ThrowExactly` instead of `Throw`.
1 parent 668f26e commit fbfb605

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

UnitTests/UnitTests.Shared/Collections/ObservableGroupedCollectionExtensionsTests.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void First_WhenGroupDoesNotExist_ShouldThrow()
3636

3737
Action action = () => groupedCollection.First("I do not exist");
3838

39-
action.Should().Throw<InvalidOperationException>();
39+
action.Should().ThrowExactly<InvalidOperationException>();
4040
}
4141

4242
[TestCategory("Collections")]
@@ -92,7 +92,7 @@ public void ElementAt_WhenGroupExistsAndIndexOutOfRange_ShouldReturnThrow(int in
9292

9393
Action action = () => groupedCollection.ElementAt("B", index);
9494

95-
action.Should().Throw<ArgumentException>();
95+
action.Should().ThrowExactly<ArgumentException>();
9696
}
9797

9898
[TestCategory("Collections")]
@@ -104,7 +104,7 @@ public void ElementAt_WhenGroupDoesNotExist_ShouldThrow()
104104

105105
Action action = () => groupedCollection.ElementAt("I do not exist", 0);
106106

107-
action.Should().Throw<InvalidOperationException>();
107+
action.Should().ThrowExactly<InvalidOperationException>();
108108
}
109109

110110
[TestCategory("Collections")]
@@ -291,7 +291,7 @@ public void InsertItem_WhenGroupDoesNotExist_ShouldThrow()
291291

292292
Action action = () => groupedCollection.InsertItem("I do not exist", 0, 23);
293293

294-
action.Should().Throw<InvalidOperationException>();
294+
action.Should().ThrowExactly<InvalidOperationException>();
295295
}
296296

297297
[TestCategory("Collections")]
@@ -305,7 +305,7 @@ public void InsertItem_WhenIndexOutOfRange_ShouldThrow(int index)
305305

306306
Action action = () => groupedCollection.InsertItem("A", index, 23);
307307

308-
action.Should().Throw<ArgumentOutOfRangeException>();
308+
action.Should().ThrowExactly<ArgumentOutOfRangeException>();
309309
}
310310

311311
[TestCategory("Collections")]
@@ -347,7 +347,7 @@ public void SetItem_WhenGroupDoesNotExist_ShouldThrow()
347347

348348
Action action = () => groupedCollection.SetItem("I do not exist", 0, 23);
349349

350-
action.Should().Throw<InvalidOperationException>();
350+
action.Should().ThrowExactly<InvalidOperationException>();
351351
}
352352

353353
[TestCategory("Collections")]
@@ -361,7 +361,7 @@ public void SetItem_WhenIndexOutOfRange_ShouldThrow(int index)
361361

362362
Action action = () => groupedCollection.SetItem("A", index, 23);
363363

364-
action.Should().Throw<ArgumentOutOfRangeException>();
364+
action.Should().ThrowExactly<ArgumentOutOfRangeException>();
365365
}
366366

367367
[TestCategory("Collections")]

UnitTests/UnitTests.Shared/Collections/ReadOnlyObservableGroupedCollectionTests.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,22 +129,22 @@ public void IListImplementation_MutableMethods_ShoudThrow()
129129

130130
var testGroup = new ReadOnlyObservableGroup<string, int>("test", new ObservableCollection<int>());
131131
Action add = () => list.Add(testGroup);
132-
add.Should().Throw<NotSupportedException>();
132+
add.Should().ThrowExactly<NotSupportedException>();
133133

134134
Action clear = () => list.Clear();
135-
clear.Should().Throw<NotSupportedException>();
135+
clear.Should().ThrowExactly<NotSupportedException>();
136136

137137
Action insert = () => list.Insert(2, testGroup);
138-
insert.Should().Throw<NotSupportedException>();
138+
insert.Should().ThrowExactly<NotSupportedException>();
139139

140140
Action remove = () => list.Remove(testGroup);
141-
remove.Should().Throw<NotSupportedException>();
141+
remove.Should().ThrowExactly<NotSupportedException>();
142142

143143
Action removeAt = () => list.RemoveAt(2);
144-
removeAt.Should().Throw<NotSupportedException>();
144+
removeAt.Should().ThrowExactly<NotSupportedException>();
145145

146146
Action set = () => list[2] = testGroup;
147-
set.Should().Throw<NotSupportedException>();
147+
set.Should().ThrowExactly<NotSupportedException>();
148148

149149
var array = new object[5];
150150
Action copyTo = () => list.CopyTo(array, 0);

0 commit comments

Comments
 (0)