0

私は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(Action1 testScript):website.tests.ContentControllerTwitterTests.ContentControllerTwitterReturnsTheTwitterView()の34行目:HomeControllerTwitterTests.csの25行目

4

1 に答える 1

0

問題は命名でした...答えは

ソリューション内のフォルダーと同じ名前でコントローラーに名前を付けないでください。

古いばか:)

于 2012-04-16T21:50:52.150 に答える