public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams) { var context = new Context(automationObject, replacementsDictionary); var workflow = new Workflow(context.SolutionPath, context.ProjectPath, context.DefaultNamespace, new SqlServer(), new FileSystem(), new MessageBox(), new EntityAndMappingDialog(new SqlServer()), context.TemplateService); workflow.Run(context.RootName); }
public void Dialog_Is_Not_Displayed_When_Run_And_Template_File_Is_Not_Found() { var dialog = MockRepository.GenerateStub<IEntityAndMappingDialog>(); var fileSystem = MockRepository.GenerateStub<IFileSystem>(); fileSystem.Stub(x => x.FindFirst(null, null)).IgnoreArguments().Return(Maybe.Nothing<string>()); var workflow = new Workflow(null, null, string.Empty, MockRepository.GenerateStub<IData>(), fileSystem, MockRepository.GenerateStub<IMessageBox>(), dialog, MockRepository.GenerateStub<ITemplateService>()); workflow.Run(null); dialog.AssertWasNotCalled(x => x.Display(null, null, null, null, null), x => x.IgnoreArguments()); }
public void Dont_Create_Files_When_Template_Creation_Is_Not_Successful() { var templateService = MockRepository.GenerateStub<ITemplateService>(); templateService.Stub(x => x.Render(null, null, null)).IgnoreArguments().Return(new TransformResult(null, Enumerable.Repeat(new Exception(), 1))); var databaseService = MockRepository.GenerateStub<IData>(); databaseService.Stub(x => x.GetTableDefinition(null, null, null)).IgnoreArguments().Return(new Table()); var fileSystem = MockRepository.GenerateStub<IFileSystem>(); fileSystem.Stub(x => x.FindFirst(null, null)).IgnoreArguments().Return(Maybe.Just(string.Empty)); var workflow = new Workflow(null, string.Empty, string.Empty, databaseService, fileSystem, MockRepository.GenerateStub<IMessageBox>(), EntityAndMappingDialogStub.Create(), templateService); workflow.Run("default"); databaseService.AssertWasNotCalled(x => x.Execute(null, null, null), x => x.IgnoreArguments()); }
public void Find_Template_Files_Are_Called_When_Run() { var fileSystem = MockRepository.GenerateStub<IFileSystem>(); fileSystem.Stub(x => x.FindFirst(null, null)).IgnoreArguments().Return(Maybe.Just(string.Empty)); var workflow = new Workflow(SolutionPath, ProjectPath, string.Empty, MockRepository.GenerateStub<IData>(), fileSystem, MockRepository.GenerateStub<IMessageBox>(), MockRepository.GenerateStub<IEntityAndMappingDialog>(), MockRepository.GenerateStub<ITemplateService>()); workflow.Run(null); fileSystem.AssertWasCalled(x => x.FindFirst(SolutionPath, Workflow.EntityTemplateFilename)); fileSystem.AssertWasCalled(x => x.FindFirst(SolutionPath, Workflow.MappingTemplateFilename)); }
public void Render_Is_Called_When_Dialog_Runs_Preview_Operation() { var templateService = MockRepository.GenerateStub<ITemplateService>(); templateService.Stub(x => x.Render(null, null)).IgnoreArguments().Return(new TransformResult(null, Enumerable.Empty<Exception>())); var databaseService = MockRepository.GenerateStub<IData>(); databaseService.Stub(x => x.GetTableDefinition(null, null, null)).IgnoreArguments().Return(new Table()); var fileSystem = MockRepository.GenerateStub<IFileSystem>(); fileSystem.Stub(x => x.FindFirst(null, null)).IgnoreArguments().Return(Maybe.Just(string.Empty)); var workflow = new Workflow(null, string.Empty, string.Empty, databaseService, fileSystem, MockRepository.GenerateStub<IMessageBox>(), EntityAndMappingDialogStub.PreviewOperation(), templateService); workflow.Run("default"); templateService.AssertWasCalled(x => x.Render(null, null), x => x.IgnoreArguments()); }