Skip to content

Commit f3e759b

Browse files
Support InvalidCastException for incompatible arrays
1 parent 38400a2 commit f3e759b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/NHibernate.Test/UtilityTest/SetSnapShotFixture.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
using System.Collections;
1+
using System;
2+
using System.Collections;
23
using System.Collections.Generic;
34
using System.IO;
45
using System.Runtime.Serialization.Formatters.Binary;
56
using NHibernate.Collection.Generic.SetHelpers;
7+
using NSubstitute.ExceptionExtensions;
68
using NUnit.Framework;
79

810
namespace NHibernate.Test.UtilityTest
@@ -83,15 +85,15 @@ public void TestCopyToObjectArray()
8385
}
8486

8587
[Test]
86-
public void WhenCopyToIsCalledWithIncompatibleArrayTypeThenThrowArgumentException()
88+
public void WhenCopyToIsCalledWithIncompatibleArrayTypeThenThrowArgumentOrInvalidCastException()
8789
{
8890
var list = new List<string> { "test1", null, "test2" };
8991
ICollection sn = new SetSnapShot<string>(list);
9092

9193
var array = new int[3];
9294
Assert.That(
9395
() => sn.CopyTo(array, 0),
94-
Throws.ArgumentException);
96+
Throws.ArgumentException.Or.TypeOf<InvalidCastException>());
9597
}
9698

9799
[Test]

0 commit comments

Comments
 (0)