NUnit dnx – BlackJumboDog CoreCLR

こんにちは!前回は、xUnitどうだろうか?ということで検討していましたが、そもそもNUnitがdnxに対応してました!

NUnit 3.0.0 Release Candidate – November 1, 2015

Framework

  • The portable build now supports ASP.NET 5 and the new Core CLR.NOTE: The nunit3-console runner cannot run tests that reference the portable build. You may run such tests using NUnitLite or a platform-specific runner.

ので、移植をメインとして挑んでいくことにします!(早くデプロイしたいという気持ちが抑えられないわけではないと自分に言い聞かせる)また、注意事項が、Upgradingに書いてありました。

For example, NUnit 3.0 no longer supports ExpectedExceptionAttribute. However, preferred alternatives Assert.Throws and the ThrowsConstraint have been available for several years. If you remove the attribute from your tests and use one of the alternatives instead, you can verify that they work in your present environment and they will continue to work after conversion.

ExpectedExceptionAttributeはサポートされなくなったようです。代替として、Assert.ThrowsNUnit.Framework.Constraints.ThrowsConstraintがあるとのこと。うーん。属性によるサポートはなくなったよーみたいなことかなぁ。Exceptionの挙動は、UIスレッド(クラシックWindowsFormなApplicationException)とかAppDomain(UnhandledExceptionあたり)も絡むので、CoreCLRAppDomainの概念はそもそもないと宣言されてる。System.Windows.Formsは存在しない。どちらもないと思われる。)だとつらいとか、実は制約多いからなんかわからなくもない。VSCodeにも.Net Coreにも対応していくなら当然な流れともいえる気がします。というわけで、そのあたりも置き換えていきます! “NUnit dnx – BlackJumboDog CoreCLR” の続きを読む