Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update DeviceClassFilterTests.cs
Browse files Browse the repository at this point in the history
nefarius committed Oct 21, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent bddb6e0 commit 1e86099
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions Tests/DeviceClassFilterTests.cs
Original file line number Diff line number Diff line change
@@ -72,7 +72,7 @@ public void TestUpperFilter()
DeviceClassFilters.RemoveUpper(DeviceClassIds.XnaComposite, Service03);
// expect not null, but empty
Assert.That(DeviceClassFilters.GetUpper(DeviceClassIds.XnaComposite), Is.Not.Null);
Assert.That(DeviceClassFilters.GetUpper(DeviceClassIds.XnaComposite), Is.Empty);
Assert.That(DeviceClassFilters.GetUpper(DeviceClassIds.XnaComposite), Is.Empty);

// remove entirely
DeviceClassFilters.DeleteUpper(DeviceClassIds.XnaComposite);
@@ -94,13 +94,13 @@ public void TestLowerFilter()
// expect exactly one entry, our added service
Assert.That(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite), Is.Not.Null);
Assert.That(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite)!.Count(), Is.EqualTo(1));
CollectionAssert.Contains(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite), Service01);
Assert.That(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite), Contains.Item(Service01));

// add the same service again
DeviceClassFilters.AddLower(DeviceClassIds.XnaComposite, Service01);
// must not be added as duplicate
Assert.That(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite)!.Count(), Is.EqualTo(1));
CollectionAssert.Contains(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite), Service01);
Assert.That(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite), Contains.Item(Service01));

// add invalid service, has to throw exception
Assert.Throws(typeof(DriverServiceNotFoundException),
@@ -110,21 +110,21 @@ public void TestLowerFilter()
DeviceClassFilters.AddLower(DeviceClassIds.XnaComposite, Service03);
// expect to get 2 services now
Assert.That(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite)!.Count(), Is.EqualTo(2));
CollectionAssert.Contains(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite), Service01);
CollectionAssert.Contains(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite), Service03);
Assert.That(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite), Contains.Item(Service01));
Assert.That(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite), Contains.Item(Service03));

// remove first service
DeviceClassFilters.RemoveLower(DeviceClassIds.XnaComposite, Service01);
// expect to get one service now, excluding the removed one
Assert.That(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite)!.Count(), Is.EqualTo(1));
CollectionAssert.DoesNotContain(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite), Service01);
CollectionAssert.Contains(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite), Service03);
Assert.That(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite), Does.Not.Contain(Service01));
Assert.That(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite), Contains.Item(Service03));

// remove remaining service
DeviceClassFilters.RemoveLower(DeviceClassIds.XnaComposite, Service03);
// expect not null, but empty
Assert.That(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite), Is.Not.Null);
CollectionAssert.IsEmpty(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite));
Assert.That(DeviceClassFilters.GetLower(DeviceClassIds.XnaComposite), Is.Empty);

// remove entirely
DeviceClassFilters.DeleteLower(DeviceClassIds.XnaComposite);

0 comments on commit 1e86099

Please sign in to comment.