scriptcs/scriptcs — pull request #508 by filipw (2013-11-08 08:16:19+00:00)
Title: Change: Create ScriptCs host based on concrete type rather than IScriptHost interface

This is a follow up to #506.

1) we now create the host based on the host type not `IScriptHost` interface (all type members are accessible from script)
2) `IScriptHost` is now only a marker interface. Implementing custom host can mean I don't have to use `ScriptArgs` or `Require`
For example

public class MyScriptHostFactory : IScriptHostFactory
{
public IScriptHost CreateScriptHost(IScriptPackManager scriptPackManager, string[] scriptArgs)
{
return new MyHost();
}
}

public class MyHost: IScriptHost
{
public void SayHi()
{
Console.WriteLine("Hi");
}
}

However I can choose to support them ,and add my own host methods (by inheriting from `ScriptHost`):

public class MyScriptHostFactory : IScriptHostFactory
{
public IScriptHost CreateScriptHost(IScriptPackManager scriptPackManager, string[] scriptArgs)
{
return new MyHost(scriptPackManager, scriptArgs);
}
}

public class MyHost: ScriptHost
{
public MyHost(IScriptPackManager scriptPackManager, string[] scriptArgs) : base(scriptPackManager, scriptArgs)
{
}

public void SayHi()
{
Console.WriteLine("Hi");
}
}

3) `IScriptHostFactory` and `IScriptHost` have been moved to Contracts. This is finally possible as we don't need an explicit reference to contracts in the Roslyn Engine (since the concrete host type, is not there). This makes it much easier to create custom hosts too.

4) Changed some tests since Castle Proxy mocks cannot expose assembly property of their type (dynamic) so we need to test against concrete types