public void ShouldComposeScripts([Frozen] Mock<IFileSystem> fileSystem, Mock<IScriptLibraryComposer> composer) { var cmd = new ExecuteScriptCommand( null, null, fileSystem.Object, new Mock<IScriptExecutor>().Object, new Mock<IScriptPackResolver>().Object, new TestLogProvider(), new Mock<IAssemblyResolver>().Object, new Mock<IFileSystemMigrator>().Object, composer.Object); cmd.Execute(); composer.Verify(c => c.Compose(It.IsAny<string>(),null)); }
public void Execute() { if (this.CommandArgs == null) { throw new InvalidOperationException("The command args are missing."); } var services = ScriptServicesBuilderFactory.Create(this.CommandArgs, this.ScriptArgs).Build(); var command = new ExecuteScriptCommand( this.CommandArgs.ScriptName, this.ScriptArgs, services.FileSystem, services.Executor, services.ScriptPackResolver, services.Logger, services.AssemblyResolver); this.Result = command.Execute(); }
public void Execute() { if (this.Config == null) { throw new InvalidOperationException("The config is missing."); } var services = ScriptServicesBuilderFactory.Create(this.Config, this.ScriptArgs).Build(); var command = new ExecuteScriptCommand( this.Config.ScriptName, this.ScriptArgs, services.FileSystem, services.Executor, services.ScriptPackResolver, services.LogProvider, services.AssemblyResolver, services.FileSystemMigrator, services.ScriptLibraryComposer); this.Result = command.Execute(); }
public void MigratesTheFileSystem( [Frozen] Mock<IFileSystem> fileSystem, [Frozen] Mock<IFileSystemMigrator> fileSystemMigrator) { // arrange var sut = new ExecuteScriptCommand( null, null, fileSystem.Object, new Mock<IScriptExecutor>().Object, new Mock<IScriptPackResolver>().Object, new TestLogProvider(), new Mock<IAssemblyResolver>().Object, fileSystemMigrator.Object, new Mock<IScriptLibraryComposer>().Object); // act sut.Execute(); // assert fileSystemMigrator.Verify(m => m.Migrate(), Times.Once); }