Skip to content

Commit

Permalink
Convert to Assert.That
Browse files Browse the repository at this point in the history
  • Loading branch information
ondfisk committed Jun 7, 2024
1 parent 76d731f commit aeec65d
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 73 deletions.
20 changes: 4 additions & 16 deletions C5.Tests/Arrays/ArrayListTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,24 +1166,12 @@ public void CopyToTooFar()
[TestFixture]
public class Sync
{
private ArrayList<int> list;


[SetUp]
public void Init()
{
list = new ArrayList<int>();
}


[TearDown]
public void Dispose() { list.Dispose(); }


[Test]
public void Get()
public void ArrayList_has_SyncRoot()
{
Assert.IsNotNull(((System.Collections.IList)list).SyncRoot);
var list = new ArrayList<int>();

Assert.That(((System.Collections.IList)list).SyncRoot, Is.Not.Null);
}
}
}
Expand Down
19 changes: 3 additions & 16 deletions C5.Tests/Arrays/HashedArrayListTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1092,24 +1092,11 @@ public void CopyToTooFar()
[TestFixture]
public class Sync
{
private HashedArrayList<int> list;


[SetUp]
public void Init()
{
list = new HashedArrayList<int>();
}


[TearDown]
public void Dispose() { list.Dispose(); }


[Test]
public void Get()
public void HashedArrayList_has_SyncRoot()
{
Assert.IsNotNull(((System.Collections.IList)list).SyncRoot);
var list = new HashedArrayList<int>();
Assert.That(((System.Collections.IList)list).SyncRoot, Is.Not.Null);
}
}
}
Expand Down
1 change: 0 additions & 1 deletion C5.Tests/BasesTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ public void Check()
thesize = 3
};
abt[2] = "aaa";
// Assert.IsFalse(abt.Check());
abt[0] = "##";
abt[1] = "##";
Assert.That(abt.Check(), Is.True);
Expand Down
20 changes: 4 additions & 16 deletions C5.Tests/LinkedLists/HashedLinkedListTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -499,24 +499,12 @@ public void CopyToTooFar()
[TestFixture]
public class Sync
{
private HashedLinkedList<int> list;


[SetUp]
public void Init()
{
list = new HashedLinkedList<int>();
}


[TearDown]
public void Dispose() { list.Dispose(); }


[Test]
public void Get()
public void HashedLinkedList_has_SyncRoot()
{
Assert.IsNotNull(((System.Collections.IList)list).SyncRoot);
var list = new HashedLinkedList<int>();

Assert.That(((System.Collections.IList)list).SyncRoot, Is.Not.Null);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion C5.Tests/LinkedLists/LinkedListTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ public void Init()
[Test]
public void Get()
{
Assert.IsNotNull(((System.Collections.IList)list).SyncRoot);
Assert.That(((System.Collections.IList)list).SyncRoot, Is.Not.Null);
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions C5.Tests/Refactored/ArrayListTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,21 @@

using NUnit.Framework;
using System;
using SCG = System.Collections.Generic;

namespace C5.Tests;

public class ArrayListTests
{
[Test]
public void ArrayList_Implements_IReadOnlyList()
{
var list = new ArrayList<int> { 0, 1, 2, 3, 4 } as SCG.IReadOnlyList<int>;

Assert.That(list, Has.Count.EqualTo(5));
Assert.That(list[2], Is.EqualTo(2));
}

[Test]
public void IList_index_set_given_null_when_T_is_value_type_throws()
{
Expand Down
19 changes: 0 additions & 19 deletions C5.Tests/Refactored/IReadOnlyListTests.cs

This file was deleted.

4 changes: 2 additions & 2 deletions C5.Tests/Wrappers/GuardedDictionaryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public void Keys_returns_GuardedCollectionValue()

var guarded = new GuardedDictionary<int, string>(source);

Assert.IsAssignableFrom<GuardedCollectionValue<int>>(guarded.Keys);
Assert.That(guarded.Keys, Is.AssignableFrom<GuardedCollectionValue<int>>());
}

[Test]
Expand Down Expand Up @@ -47,7 +47,7 @@ public void Values_returns_GuardedCollectionValue()

var guarded = new GuardedDictionary<int, string>(source);

Assert.IsAssignableFrom<GuardedCollectionValue<string>>(guarded.Values);
Assert.That(guarded.Values, Is.AssignableFrom<GuardedCollectionValue<string>>());
}

[Test]
Expand Down
4 changes: 2 additions & 2 deletions C5.Tests/Wrappers/GuardedSortedDictionaryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void Keys_returns_GuardedSorted()

var guarded = new GuardedSortedDictionary<int, string>(source);

Assert.IsAssignableFrom<GuardedSorted<int>>(guarded.Keys);
Assert.That(guarded.Keys, Is.AssignableFrom<GuardedSorted<int>>());
}

[Test]
Expand Down Expand Up @@ -53,7 +53,7 @@ public void Values_returns_GuardedCollectionValue()

var guarded = new GuardedSortedDictionary<int, string>(source);

Assert.IsAssignableFrom<GuardedCollectionValue<string>>(guarded.Values);
Assert.That(guarded.Values, Is.AssignableFrom<GuardedCollectionValue<string>>());
}

[Test]
Expand Down

0 comments on commit aeec65d

Please sign in to comment.