1
Vote

Enhancement: Expose Host AppDomain

description

Hi,
 
We have started using CassiniDev in an internal project (great tool by the way!). We are using it in conjunction with Watin and FirefoxPortable to do web UI testing.
 
We had an issue that required access to the hosted AppDomain. We needed to modify some comms behaviour within the virtual directory. We had a static class that we wanted to instantiate with some injected behaviour to ensure testing was possible without a full service stack.
 
To enable this, we exposed a property on Host to provide the AppDomain.CurrentDomain, and exposed this via a property on the Server called HostAppDomain. We wrap this in a modified CassiniDevServer class so that we can write code such as:
 
Server _server = new Server(..);
StaticType remoteObject = (StaticType)_server.HostAppDomain.CreateInstanceAndUnwrap("Assembly.Type.Exists.In","NameSpace.To.StaticType");
remoteObject.ExecuteMethod("Running in AppDomain for VirtualDirectory");
 
Attached are the changes required (there were a few other properties added that we found useful). Not sure if there is an easier way to achieve what we were trying to do, happy to discuss. Would be great if this ability could be provided in the trunk though... :)
 
Regards,
 
Ben
 
PS Apologies about zip file, couldn't attach more than one file???? (sigh)

file attachments

comments

Sky wrote Jun 11, 2012 at 8:18 AM

thank you for your contribution. it will be included in the next push.

wrote Jun 11, 2012 at 8:19 AM

wrote Feb 21, 2013 at 11:19 PM