Skip to content

Commit 2c84730

Browse files
committed
Add test for argument exception
1 parent 7c94554 commit 2c84730

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/NHibernate.Test/UtilityTest/SetSnapShotFixture.cs

+12
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@ public void TestCopyToObjectArray()
8282
Assert.That(list, Is.EquivalentTo(array));
8383
}
8484

85+
[Test]
86+
public void WhenCopyToIsCalledWithIncompatibleArrayTypeThenThrowArgumentException()
87+
{
88+
var list = new List<string> { "test1", null, "test2" };
89+
ICollection sn = new SetSnapShot<string>(list);
90+
91+
var array = new int[3];
92+
Assert.That(
93+
() => sn.CopyTo(array, 0),
94+
Throws.ArgumentException);
95+
}
96+
8597
[Test]
8698
public void TestSerialization()
8799
{

0 commit comments

Comments
 (0)