Skip to content

Commit 8fcb479

Browse files
committed
Update tests
1 parent c6f403b commit 8fcb479

File tree

4 files changed

+29
-20
lines changed

4 files changed

+29
-20
lines changed

Labyrinthian.Tests/DataStructures/DisjointSetTest.cs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,48 +13,51 @@ public void Add()
1313
{
1414
Assert.That(set.Add(i), Is.True);
1515
}
16-
Assert.That(set.Add(arr[0]), Is.False);
1716

18-
CollectionAssert.AreEquivalent(arr, set);
17+
using (Assert.EnterMultipleScope())
18+
{
19+
Assert.That(set.Add(arr[0]), Is.False);
20+
Assert.That(set, Is.EquivalentTo(arr));
21+
}
1922
}
2023

2124
[Test]
2225
public void IEnumerableConstructor()
2326
{
2427
int[] arr = [0, 1, 2, 3];
25-
DisjointSet<int> set = [];
28+
DisjointSet<int> set = [0, 1, 2, 3];
2629

27-
CollectionAssert.AreEquivalent(arr, set);
30+
Assert.That(set, Is.EquivalentTo(arr));
2831
}
2932

3033
[Test]
3134
public void Contains()
3235
{
33-
DisjointSet<char> set = [];
36+
DisjointSet<char> set = ['a', 'b', 'c', 'd'];
3437

35-
Assert.Multiple(() =>
38+
using (Assert.EnterMultipleScope())
3639
{
3740
Assert.That(set.Contains('a'), Is.True);
3841
Assert.That(set.Contains('c'), Is.True);
3942
Assert.That(set.Contains('d'), Is.True);
4043
Assert.That(set.Contains('e'), Is.False);
4144
Assert.That(set.Contains('0'), Is.False);
42-
});
45+
}
4346
}
4447

4548
[Test]
4649
public void Union()
4750
{
48-
DisjointSet<int> set = [];
51+
DisjointSet<int> set = [1, 2, 3];
4952

50-
Assert.Multiple(() =>
53+
using (Assert.EnterMultipleScope())
5154
{
5255
Assert.That(set.Union(1, 2), Is.True);
5356
Assert.That(set.Union(2, 1), Is.False);
5457
Assert.That(set.Union(1, 3), Is.True);
5558
Assert.That(set.Union(2, 3), Is.False);
5659
Assert.That(set.Union(1, 1), Is.False);
57-
});
60+
}
5861
}
5962

6063
[Test]
@@ -71,7 +74,7 @@ public void Find()
7174
// 7-8
7275
set.Union(7, 8);
7376

74-
Assert.Multiple(() =>
77+
using (Assert.EnterMultipleScope())
7578
{
7679
// 1-2-3
7780
Assert.That(set.Find(1), Is.EqualTo(set.Find(2)));
@@ -90,7 +93,7 @@ public void Find()
9093
Assert.That(set.Find(2), Is.Not.EqualTo(set.Find(6)));
9194
// 4-5-6 != 9
9295
Assert.That(set.Find(6), Is.Not.EqualTo(set.Find(9)));
93-
});
96+
}
9497
}
9598
}
9699
}

Labyrinthian.Tests/DataStructures/StaticUnorderedListTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public void CopyTo_CopiesListItemsToArray()
183183

184184
list.CopyTo(array, 0);
185185

186-
CollectionAssert.AreEqual(expected, array);
186+
Assert.That(array, Is.EqualTo(expected));
187187
}
188188
}
189189
}

Labyrinthian.Tests/Labyrinthian.Tests.csproj

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,17 @@
1010
</PropertyGroup>
1111

1212
<ItemGroup>
13-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
14-
<PackageReference Include="NUnit" Version="3.13.3" />
15-
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
16-
<PackageReference Include="NUnit.Analyzers" Version="3.6.1" />
17-
<PackageReference Include="coverlet.collector" Version="3.2.0" />
13+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
14+
<PackageReference Include="NUnit" Version="4.3.2" />
15+
<PackageReference Include="NUnit3TestAdapter" Version="5.0.0" />
16+
<PackageReference Include="NUnit.Analyzers" Version="4.9.2">
17+
<PrivateAssets>all</PrivateAssets>
18+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
19+
</PackageReference>
20+
<PackageReference Include="coverlet.collector" Version="6.0.4">
21+
<PrivateAssets>all</PrivateAssets>
22+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
23+
</PackageReference>
1824
</ItemGroup>
1925

2026
<ItemGroup>

Labyrinthian.Tests/Mazes/MazeCellsTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ public void SetNeighborsWorks()
7777

7878
Assert.Multiple(() =>
7979
{
80-
CollectionAssert.AreEqual(neighbors, cell.Neighbors);
81-
CollectionAssert.AreEqual(directedNeighbors, cell.DirectedNeighbors);
80+
Assert.That(cell.Neighbors, Is.EquivalentTo(neighbors));
81+
Assert.That(cell.DirectedNeighbors, Is.EquivalentTo(directedNeighbors));
8282
});
8383
}
8484

0 commit comments

Comments
 (0)