public ExitCode Execute(string[] arguments) { if (arguments.Length != 1 || string.IsNullOrEmpty(arguments[0])) { log.ErrorMessage(usage); return(ExitCode.Error); } string path = arguments[0]; if (fileSystem.DirectoryExists(path)) { log.ErrorMessage("A site at '{0}' already exists.", path); return(ExitCode.Error); } fileSystem.CreateDirectory(path); fileSystem.ChangeDirectory(path, () => { CreateMinimalSite(); PopulateSite(); }); log.InfoMessage("Created a blank mulder site at '{0}'. Enjoy!", path); return(ExitCode.Success); }
public void SetUp() { validPath = Path.Combine("some", "valid", "path"); log = Substitute.For <ILog>(); fileSystem = Substitute.For <IFileSystem>(); dataSource = Substitute.For <IDataSource>(); fileSystem.DirectoryExists(validPath).Returns(false); fileSystem.ChangeDirectory(validPath, Arg.Invoke()); createSiteCommand = new CreateSiteCommand(log, fileSystem, dataSource); }
public void SetUp() { validPath = Path.Combine("some", "valid", "path"); log = Substitute.For<ILog>(); fileSystem = Substitute.For<IFileSystem>(); dataSource = Substitute.For<IDataSource>(); fileSystem.DirectoryExists(validPath).Returns(false); fileSystem.ChangeDirectory(validPath, Arg.Invoke()); createSiteCommand = new CreateSiteCommand(log, fileSystem, dataSource); }