Given the following fairly simple class hierarchy (which executes a function through some indirection), I get an IndexOutOfRangeException rather than the exception that should be getting called here.
This worked correctly in 5.3.4 but fails in 6.0.1.
Running VS2008SP1 on WinXPSP3.
public class BaseClass<TSomething> where TSomething : class
{
protected BaseClass()
{
throw new NotImplementedException("Don't call this.");
}
protected virtual TResponse Execute<TResponse>(Func<TResponse> action) where TResponse : class
{
if (action == null)
{
throw new ArgumentNullException("action");
}
return action.Invoke();
}
}
public interface IDoWork
{
// Placeholder, just for filling in the generic type.
}
public class DerivedClass : BaseClass<IDoWork>
{
public TResponse ExecutePublic<TResponse>(Func<TResponse> action) where TResponse : class
{
return this.Execute(action);
}
}
[TestFixture]
[Isolated]
public class MyTestFixture
{
[Test]
public void MyTest()
{
var obj = Isolate.Fake.Instance<DerivedClass>(Members.CallOriginal, ConstructorWillBe.Ignored);
const Func<string> func = null;
Assert.Throws<ArgumentNullException>(() => obj.ExecutePublic(func)); // Will be IndexOutOfRange
}
}