Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #1299 from aaron-hardin/dev
Register the _replType if specified, otherwise use the default Repl
  • Loading branch information
filipw committed Jun 7, 2020
2 parents 295ebf1 + ee571fd commit fc0f028
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 fc0f028

Please sign in to comment.