私はSteveSandersonの素晴らしいMVC統合テストフレームワークの適応を使用しています。
アプリケーションで任意のビューを取得し、このフレームワークを介して提供する場合(基本的にはを介して「偽の」ワーカー要求を作成しHttpRuntime.ProcessRequest()
ます)、統合テストのコンテキストでASP.NETランタイム内でホストできます。
私の質問は、なぜHomeController
このプロセスをうまく通過するのに、他のコントローラーが応答するのかということです。
パス'get'は禁止されています
任意のビューをHomeControllerに移動して、問題なくテストできます。2つの呼び出しの間にワーカーリクエストの偽物の違い(URLが耐えられない)は見られません。途方に暮れています!
テスト出力のスタックトレース:
ContentControllerTwitterReturnsTheTwitterView:FailedSystem.NullReferenceException:オブジェクト参照がオブジェクトのインスタンスに設定されていません。
サーバースタックトレース:Website.tests.ContentControllerTwitterTests.b__0(BrowsingSession session)at MvcIntegrationTestFramework.Hosting.AppDomainProxy.RunBrowsingSessionInAppDomain(SerializableDelegate`1 script)in AppDomainProxy.cs:line 19 at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage( IntPtr md、Object [] args、Object server、Int32 methodPtr、Boolean fExecuteInContext、Object []&outArgs)at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg、Int32 methodPtr、Boolean fExecuteInContext)
[0]で再スローされた例外:System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg、IMessage retMsg)at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(ref MessageData msgData、Int32 type)at MvcIntegrationTestFramework.Hosting AppHost.csの.AppDomainProxy.RunBrowsingSessionInAppDomain(SerializableDelegate
1 script) at MvcIntegrationTestFramework.Hosting.AppHost.Start(Action
1 testScript):website.tests.ContentControllerTwitterTests.ContentControllerTwitterReturnsTheTwitterView()の34行目:HomeControllerTwitterTests.csの25行目