Skip to content

Commit 04f55af

Browse files
authored
Add tests (#4)
1 parent b67c1ca commit 04f55af

File tree

4 files changed

+22
-1
lines changed

4 files changed

+22
-1
lines changed

src/Common.Tests/Collections/TestArray2D.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,8 @@ public void TestVectorIndexer()
398398
{
399399
Assert.AreEqual(i + 1, array[vectors[i]]);
400400
}
401+
402+
Assert.AreEqual(2, array[3, 4]);
401403
}
402404

403405
[TestMethod]

src/Common.Tests/Collections/TestBitArray2D.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,5 +172,15 @@ public void TestCopy()
172172
Assert.AreEqual(array.Columns, copy.Columns);
173173
CollectionAssert.AreEqual(array.Array, copy.Array);
174174
}
175+
176+
[TestMethod]
177+
public void TestVectorIndexer()
178+
{
179+
var array = new BitArray2D(10, 10);
180+
var index = new Vector2DInt(1, 2);
181+
array[index] = true;
182+
Assert.IsTrue(array[index]);
183+
Assert.AreEqual(array[1, 2], array[index]);
184+
}
175185
}
176186
}

src/Common.Tests/Collections/TestDataContractDictionary.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ public void TestDictionaryCast()
309309
[TestMethod]
310310
public void TestTryGetValue()
311311
{
312-
var dict = new Dictionary<int, int>
312+
var dict = new DataContractDictionary<int, int>
313313
{
314314
{ 1, 2 },
315315
{ 3, 4 },

src/Common.Tests/Collections/TestDataContractHashSet.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ public void TestEnumerator()
6565
}
6666
}
6767

68+
[TestMethod]
69+
public void TestGetEnumerator()
70+
{
71+
var set = new DataContractHashSet<int> { 1 };
72+
var enumerator = ((IEnumerable<int>)set).GetEnumerator();
73+
Assert.IsTrue(enumerator.MoveNext());
74+
Assert.AreEqual(1, enumerator.Current);
75+
}
76+
6877
[TestMethod]
6978
public void TestAdd()
7079
{

0 commit comments

Comments
 (0)