public ExpectedExceptionTestCase AddThrow(int parameterIndex, Object value, Type exceptionType) { // copy parameters Object[] ps = new Object[this.parameters.Length]; this.parameters.CopyTo(ps, 0); ps[parameterIndex] = value; string pname = this.parameterInfos[parameterIndex].Name; pname = Char.ToUpper(pname[0]) + pname.Substring(1, pname.Length - 1); // create new name string caseName = String.Format("{0}With{1}NulledShouldThrow{2}", this.method.Name, pname, exceptionType.Name ); // create type // create case MethodTestCase tc = MbUnit.Framework.TestCases.Case(caseName, testedInstance, method, ps); ExpectedExceptionTestCase etc = MbUnit.Framework.TestCases.ExpectedException(tc, exceptionType); this.Suite.Add(etc); return(etc); }
public ExpectedExceptionTestCase AddThrow(int parameterIndex, Object value, Type exceptionType) { // copy parameters Object[] ps = new Object[this.parameters.Length]; this.parameters.CopyTo(ps, 0); ps[parameterIndex] = value; // create new name string caseName = String.Format("{0}{1}ModifiedShouldThrow{2}", this.name, this.parameterInfos[parameterIndex].Name, exceptionType.Name ); // create case MethodTestCase tc = MbUnit.Framework.TestCases.Case(caseName, method, ps); ExpectedExceptionTestCase etc = MbUnit.Framework.TestCases.ExpectedException(tc, exceptionType); this.testCases.Add(etc.Name, etc); return(etc); }