I am using an adaptation of Steve Sanderson’s wonderful MVC Integration Testing Framework.
If I take any view in my application and serve it through this framework (which basically creates a ‘fake’ worker request through HttpRuntime.ProcessRequest()) I can host it within the ASP.NET Runtime in the context of my integration test.
My question is why would any view from the HomeController go nicely through this process but any other controller give a response with
Path ‘get’ is forbidden
I can move any view to the HomeController and test it without issue. I see no difference (url not withstanding) of the worker request fake between the two calls. I am at a loss!
Stack trace in test output:
ContentControllerTwitterReturnsTheTwitterView :
FailedSystem.NullReferenceException : Object reference not set to an
instance of an object.Server stack trace: at
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)Exception rethrown at [0]: at
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.AppDomainProxy.RunBrowsingSessionInAppDomain(SerializableDelegate11
script) at MvcIntegrationTestFramework.Hosting.AppHost.Start(Action
testScript) in AppHost.cs: line 34 at
website.tests.ContentControllerTwitterTests.ContentControllerTwitterReturnsTheTwitterView()
in HomeControllerTwitterTests.cs: line 25
Problem was naming … answer is
Old fool 🙂