I want to test an invoked private method from a certain class. It should throw ArgumentNullException
. But unfortunatley I get this message:
Expected: <System.ArgumentNullException> But was: null
[TestCaseSource("InvalidValidInput")]
public void T2(EMP exmpl,List<string> wrongIn)
{
ClassConverter cc = new ClassConverter();
Type ccType = cc.GetType();
MethodInfo converter = ccType.GetMethod("Convert", BindingFlags.NonPublic | BindingFlags.Instance);
var tooManyInp = Assert.Throws<ArgumentNullException>(() => converter.Invoke(cc, new object[]
{
exmpl,
wrongIn
}));
Assert.IsInstanceOf<ArgumentNullException>(tooManyInp.InnerException);
}
}
Aucun commentaire:
Enregistrer un commentaire