문제

I've got an MbUnit unit test that I want to use Row tests for, and as one of the parameters, I want to pass a delegate. So something like this:

public delegate object MyDelegate();
[Test]
[Row(SpecificDelegate)]
public void MyTest(MyDelegate specificDelegate)
{
    // DO TEST
}
public object SpecificDelegate()
{
    return null;
}

However, this doesn't seem to work - I get the following error:

Argument 1: cannot convert from 'method group' to 'object[]'

Is there any way of doing this?

도움이 되었습니까?

해결책

I'd use a [Factory] instead, see the docs about it for more information.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top