Another MbUnit mystery

time to read 3 min | 526 words

I'm trying to get MbUnit TypeFixture to work, but I'm having problems with exceptions where they shouldn't.

The code I'm using was taken from here and wasn't changed except what needed to maek it compile.

As far as I can see, it should work, but I keep getting this annoying exception:

 Message: Parameter count mismatch.
Type: System.Reflection.TargetParameterCountException
Source: mscorlib
TargetSite: System.Object Invoke(System.Object, System.Reflection.BindingFlags, System.Reflection.Binder, System.Object[], System.Globalization.CultureInfo)
HelpLink: null
Stack: at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at MbUnit.Core.TypeHelper.Invoke(MethodInfo method, Object o, IList args)
at MbUnit.Core.Invokers.MethodRunInvoker.Execute(Object o, IList args)
at MbUnit.Core.Invokers.ExpectedExceptionRunInvoker.Execute(Object o, IList args)

 

Here is the code that I'm using:

using System;
using System.Collections;
using MbUnit.Core.Framework;
using MbUnit.Framework;
public class ArrayListFactory
{
    public ArrayList Empty
    {
        get
        {
            return new ArrayList();
        }
    }
    public ArrayList TwoElems
    {
        get
        {
            ArrayList list = new ArrayList();
            list.Add(0);
            list.Add(1);
            return list;
        }
    }
}
[TypeFixture(typeof(IEnumerable))]
[ProviderFactory(typeof(ArrayListFactory), typeof(IEnumerable))]
public class EnumerableFixture
{
    [Test]
    [ExpectedException(
         typeof(InvalidOperationException),
         "Current called while cursor is before the first element"
    )]
    public void CurrentCalledBeforeMoveNext(IEnumerable en)
    {
          IEnumerator  er = en.GetEnumerator(); 
          object p = er.Current;
    }
    [Test]
    [ExpectedException(
         typeof(InvalidOperationException),
         "Current called while cursor is past the last element"
    )]
    public void CurrentCalledAfterFinishedMoveNext(IEnumerable en)
    {
          IEnumerator  er = en.GetEnumerator(); 
          while(er.MoveNext());
          object p = er.Current;
    }
}

 

Any help would be appriciated.