private void execute() { _plan.AddStep(MockFor <ITemplateStep>()); MockFor <ITemplateStep>() .Expect(s => s.Execute(null)) .IgnoreArguments() .WhenCalled(mi => { _context = (TemplatePlanContext)mi.Arguments[0]; }); ClassUnderTest.Execute(_input, _plan, ctx => { }); }
public override bool Execute(NewCommandInput input) { var plan = new TemplatePlan(); var findContentStep = input.GitFlag.IsNotEmpty() ? (ITemplateStep) new CloneGitRepository(ProcessFactory, FileSystem) : new UnzipTemplate(ZipService); plan.AddStep(findContentStep); plan.AddStep(new ReplaceKeywords(KeywordReplacer, FileSystem)); if (input.SolutionFlag.IsNotEmpty()) { plan.AddStep(new ModifySolution(SolutionFileService, CsProjGatherer)); } plan.AddStep(new MoveContent(FileSystem)); if (input.RakeFlag.IsNotEmpty()) { plan.AddStep(new RunRakeFile(FileSystem, RakeRunner)); } plan.AddStep(new AutoRunFubuRake(FileSystem, RakeRunner)); plan.AddStep(new RemoveTemporaryContent()); var hasErrors = false; PlanExecutor.Execute(input, plan, ctx => { Console.ForegroundColor = ConsoleColor.Red; ctx.Errors.Each(error => Console.WriteLine(error)); Console.ForegroundColor = ConsoleColor.White; hasErrors = ctx.Errors.Any(); }); if (hasErrors) { return(false); } Console.WriteLine("Solution {0} created", input.ProjectName); return(true); }