Skip to content

Commit

Permalink
chore: resolve NUnit warnings (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
hazzik committed Mar 21, 2024
1 parent e7c8413 commit d93a7e8
Showing 1 changed file with 41 additions and 41 deletions.
82 changes: 41 additions & 41 deletions src/Iesi.Collections.Test/Generic/GenericSetFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,18 @@ public void CopyTo()

foreach (string obj in dest)
{
Assert.IsTrue(_set.Contains(obj), "set should contain the object in the array");
Assert.That(_set.Contains(obj), "set should contain the object in the array");
count++;
}

Assert.AreEqual(3, count, "should have 3 items in array");
Assert.That(count, Is.EqualTo(3), "should have 3 items in array");
}

[Test]
public void Count()
{
Assert.AreEqual(3, _set.Count, "should be 3 items");
Assert.AreEqual(0, CreateInstance().Count, "new set should have nothing in it.");
Assert.That(_set, Has.Count.EqualTo(3), "should be 3 items");
Assert.That(CreateInstance(), Is.Empty, "new set should have nothing in it.");
}

#endregion
Expand All @@ -75,12 +75,12 @@ public void CtorWithDefaults()

ISet<string> theSet = CreateInstance(init);

Assert.AreEqual(3, init.Count, "3 items in set");
Assert.That(init, Has.Count.EqualTo(3), "3 items in set");

int index = 0;
foreach (string obj in init)
{
Assert.IsTrue(theSet.Contains(obj), "set should contain obj at index = " + index.ToString());
Assert.That(theSet.Contains(obj), "set should contain obj at index = " + index.ToString());
index++;
}
}
Expand All @@ -94,11 +94,11 @@ public void Add()
{
try
{
Assert.IsTrue(_set.Add("four"), "should have added 'four'");
Assert.AreEqual(4, _set.Count, "should have added 'four'");
Assert.That(_set.Add("four"), "should have added 'four'");
Assert.That(_set, Has.Count.EqualTo(4), "should have added 'four'");

Assert.IsFalse(_set.Add(two), "'two' was already there");
Assert.AreEqual(4, _set.Count, "object already in set");
Assert.That(_set.Add(two), Is.False, "'two' was already there");
Assert.That(_set, Has.Count.EqualTo(4), "object already in set");
if (_set.IsReadOnly)
Assert.Fail("Read-only set can be modified");
}
Expand All @@ -120,10 +120,10 @@ public void UnionWith()
try
{
_set.UnionWith(addAll);
Assert.AreEqual(5, _set.Count, "should have added one 'four' and 'five'");
Assert.That(_set, Has.Count.EqualTo(5), "should have added one 'four' and 'five'");

_set.UnionWith(addAll);
Assert.AreEqual(5, _set.Count, "no new objects should have been added");
Assert.That(_set, Has.Count.EqualTo(5), "no new objects should have been added");

if (_set.IsReadOnly)
Assert.Fail("Read-only set can be modified");
Expand All @@ -141,7 +141,7 @@ public void Clear()
try
{
_set.Clear();
Assert.AreEqual(0, _set.Count, "should have no items in ISet.");
Assert.That(_set, Is.Empty, "should have no items in ISet.");

if (_set.IsReadOnly)
Assert.Fail("Read-only set can be modified");
Expand All @@ -156,8 +156,8 @@ public void Clear()
[Test]
public void Contains()
{
Assert.IsTrue(_set.Contains(one), "does contain one");
Assert.IsFalse(_set.Contains("four"), "does not contain 'four'");
Assert.That(_set.Contains(one), "does contain one");
Assert.That(_set.Contains("four"), Is.False, "does not contain 'four'");
}

[Test]
Expand All @@ -167,19 +167,19 @@ public void IsSupersetOf()
all.Add("one");
all.Add("two");

Assert.IsTrue(_set.IsSupersetOf(all), "should contain 'one' and 'two'");
Assert.That(_set.IsSupersetOf(all), "should contain 'one' and 'two'");

all.Add("not in there");
Assert.IsFalse(_set.IsSupersetOf(all), "should not contain the just added 'not in there'");
Assert.That(_set.IsSupersetOf(all), Is.False, "should not contain the just added 'not in there'");
}


[Test]
public void IsSubsetOfTest()
{
Assert.That(_set.IsSubsetOf(new[] { "one", "two" }), Is.False);
Assert.That(_set.IsSubsetOf(new[] { "one", "two", "three" }), Is.True);
Assert.That(_set.IsSubsetOf(new[] { "one", "two", "three", "four" }), Is.True);
Assert.That(_set.IsSubsetOf(new[] { "one", "two", "three" }));
Assert.That(_set.IsSubsetOf(new[] { "one", "two", "three", "four" }));
}


Expand All @@ -188,7 +188,7 @@ public void IsProperSubsetOfTest()
{
Assert.That(_set.IsProperSubsetOf(new[] { "one", "two", "three" }), Is.False);
Assert.That(_set.IsProperSubsetOf(new[] { "one", "two", "nine" }), Is.False);
Assert.That(_set.IsProperSubsetOf(new[] { "one", "two", "three", "nine" }), Is.True);
Assert.That(_set.IsProperSubsetOf(new[] { "one", "two", "three", "nine" }));
}


Expand All @@ -197,23 +197,23 @@ public void IsProperSupersetOfTest()
{
Assert.That(_set.IsProperSupersetOf(new[] { "one", "two", "three" }), Is.False);
Assert.That(_set.IsProperSupersetOf(new[] { "one", "two", "nine" }), Is.False);
Assert.That(_set.IsProperSupersetOf(new[] { "one", "two" }), Is.True);
Assert.That(_set.IsProperSupersetOf(new[] { "one", "two" }));
}


[Test]
public void OverlapsTest()
{
Assert.That(_set.Overlaps(new[] { "one", "two", "three" }), Is.True);
Assert.That(_set.Overlaps(new[] { "one", "two" }), Is.True);
Assert.That(_set.Overlaps(new[] { "one", "two", "three" }));
Assert.That(_set.Overlaps(new[] { "one", "two" }));
Assert.That(_set.Overlaps(new[] { "six", "seven" }), Is.False);
}


[Test]
public void SetEqualsTest()
{
Assert.That(_set.SetEquals(new[] { "one", "two", "three" }), Is.True);
Assert.That(_set.SetEquals(new[] { "one", "two", "three" }));
Assert.That(_set.SetEquals(new[] { "one", "two", "three", "four" }), Is.False);
Assert.That(_set.SetEquals(new[] { "one", "two" }), Is.False);
}
Expand All @@ -231,12 +231,12 @@ public void SymmetricExceptWith()
if (_set.IsReadOnly)
Assert.Fail("Read-only set can be modified");

Assert.AreEqual(3, a.Count, "contains 3 elements - 'zero', 'one', and 'four'");
Assert.IsTrue(a.Contains("zero"), "should contain 'zero'");
Assert.IsTrue(a.Contains("one"), "should contain 'one'");
Assert.IsTrue(a.Contains("four"), "should contain 'four'");
Assert.That(a, Has.Count.EqualTo(3), "contains 3 elements - 'zero', 'one', and 'four'");
Assert.That(a.Contains("zero"), "should contain 'zero'");
Assert.That(a.Contains("one"), "should contain 'one'");
Assert.That(a.Contains("four"), "should contain 'four'");

Assert.IsTrue(b.IsSupersetOf(_bInitValues), "should not have modified b");
Assert.That(b.IsSupersetOf(_bInitValues), "should not have modified b");
}
catch (NotSupportedException)
{
Expand All @@ -257,11 +257,11 @@ public void IntersectWith()
if (_set.IsReadOnly)
Assert.Fail("Read-only set can be modified");

Assert.AreEqual(2, a.Count, "contains 2 elements - 'two', and 'three'");
Assert.IsTrue(a.Contains("two"), "should contain 'two'");
Assert.IsTrue(a.Contains("three"), "should contain 'three'");
Assert.That(a, Has.Count.EqualTo(2), "contains 2 elements - 'two', and 'three'");
Assert.That(a.Contains("two"), "should contain 'two'");
Assert.That(a.Contains("three"), "should contain 'three'");

Assert.IsTrue(b.IsSupersetOf(_bInitValues), "should not have modified b");
Assert.That(b.IsSupersetOf(_bInitValues), "should not have modified b");
}
catch (NotSupportedException)
{
Expand All @@ -283,11 +283,11 @@ public void ExceptWith()
if (_set.IsReadOnly)
Assert.Fail("Read-only set can be modified");

Assert.AreEqual(2, a.Count, "contains 2 elements - 'zero', and 'one'");
Assert.IsTrue(a.Contains("zero"), "should contain 'zero'");
Assert.IsTrue(a.Contains("one"), "should contain 'one'");
Assert.That(a, Has.Count.EqualTo(2), "contains 2 elements - 'zero', and 'one'");
Assert.That(a.Contains("zero"), "should contain 'zero'");
Assert.That(a.Contains("one"), "should contain 'one'");

Assert.IsTrue(b.IsSupersetOf(_bInitValues), "should not have modified b");
Assert.That(b.IsSupersetOf(_bInitValues), "should not have modified b");
}
catch (NotSupportedException)
{
Expand All @@ -301,11 +301,11 @@ public void Remove()
{
try
{
Assert.IsTrue(_set.Remove(one), "should have removed 'one'");
Assert.IsFalse(_set.Contains(one), "one should have been removed");
Assert.AreEqual(2, _set.Count, "should be 2 items after one removed.");
Assert.That(_set.Remove(one), "should have removed 'one'");
Assert.That(_set.Contains(one), Is.False, "one should have been removed");
Assert.That(_set, Has.Count.EqualTo(2), "should be 2 items after one removed.");

Assert.IsFalse(_set.Remove(one), "was already removed.");
Assert.That(_set.Remove(one), Is.False, "was already removed.");
if (_set.IsReadOnly)
Assert.Fail("Read-only set can be modified");
}
Expand Down

0 comments on commit d93a7e8

Please sign in to comment.