Skip to content

Commit

Permalink
Register the _replType if specified, otherwise use the default Repl #…
Browse files Browse the repository at this point in the history
  • Loading branch information
aaron-hardin committed Jan 11, 2019
1 parent e9d7734 commit ee571fd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/ScriptCs.Hosting/RuntimeServices.cs
Expand Up @@ -55,9 +55,8 @@ protected override IContainer CreateContainer()
builder.RegisterInstance(this.LogProvider).Exported(x => x.As<ILogProvider>());
builder.RegisterType(_scriptEngineType).As<IScriptEngine>().SingleInstance();
builder.RegisterType(_scriptExecutorType).As<IScriptExecutor>().SingleInstance();
builder.RegisterType(_replType).As<IRepl>().SingleInstance();
builder.RegisterType(_replType ?? typeof(Repl)).As<IRepl>().SingleInstance();
builder.RegisterType<ScriptServices>().SingleInstance();
builder.RegisterType<Repl>().As<IRepl>().SingleInstance();
builder.RegisterType<Printers>().SingleInstance();

RegisterLineProcessors(builder);
Expand Down
8 changes: 8 additions & 0 deletions test/ScriptCs.Hosting.Tests/RuntimeServicesTests.cs
Expand Up @@ -271,6 +271,14 @@ public void ShouldRegisterTheOverriddenVisualStudioSolutionWriter()
_runtimeServices.Container.Resolve<IVisualStudioSolutionWriter>().ShouldBeType(typeof(MockVisualStudioSolutionWriter));
}

[Fact]
public void ShouldRegisterTheOverriddenRepl()
{
var mock = new Mock<IRepl>();
_overrides[ typeof( IRepl ) ] = mock.Object.GetType();
_runtimeServices.Container.Resolve<IRepl>().ShouldBeType( mock.Object.GetType() );
}

[Fact]
public void ShouldLogOnDebugAnAssemblyLoadFailure()
{
Expand Down

0 comments on commit ee571fd

Please sign in to comment.