1
私はSystem.CoreとBuild Target Mono/.NET 3.5を含むプロジェクトでMD 2.8.5の単体テストを作成しました。私は本当にAssertを好きです。新しいNUnitを利用するので、拡張メソッドを書くことに決めました。私はテストと同じ名前空間にその内容として新しいファイルを作成しました。誰も私のエラーを見ることができますか?MonoDevelopを使用したMonoとExtensionのメソッド2.8.5
public delegate void TestDelegate();
public static class AssertThrows
{
public static T Throws<T>(this Assert assert, TestDelegate td)
where T : Exception
{
try
{
td();
}
catch(T e)
{
return e;
}
catch
{
throw new AssertionException("Wrong exception type.");
}
throw new AssertionException("Did not throw an error.");
}
}
MonoDevelopはコード補完によって拡張メソッドを "見ます"。しかし、コンパイラレポート:
Performing main compilation...
/Users/shamwow/dev/EngineTests.cs(19,37): error CS0117:
`NUnit.Framework.Assert' does not contain a definition for `Throws'
/Applications/MonoDevelop.app/Contents/MacOS/lib/monodevelop/AddIns/NUnit/nunit.framework.dll (Location of the symbol related to previous error)
Build complete -- 1 error, 0 warnings
(私はMDとMonoは同じではありません知っている。)
Duh!私は今朝、プレコーヒーの考えにそれを責めます。ありがとう、ジョン! – realistschuckle