public void Test_Baseline_Option_Throws_Not_Implemented_Exception() { //arrange var traceService = new Mock <ITraceService>(); var environmentService = new Mock <IEnvironmentService>(); var workspaceService = new Mock <IWorkspaceService>(); var configurationService = new Mock <IConfigurationService>(); var migrationService = new Mock <IMigrationService>(); var migrationServiceFactory = new Mock <CLI.IMigrationServiceFactory>(); migrationServiceFactory.Setup(s => s.Create("sqlserver")).Returns(migrationService.Object); var dataService = new Mock <IDataService>(); var dataServiceFactory = new Mock <CLI.IDataServiceFactory>(); dataServiceFactory.Setup(s => s.Create("sqlserver")).Returns(dataService.Object); //act var option = new BaselineOption { }; var sut = new CommandLineService(migrationServiceFactory.Object, dataServiceFactory.Object, workspaceService.Object, environmentService.Object, traceService.Object, configurationService.Object); var returnCode = sut.RunBaselineOption(option); //assert returnCode.ShouldNotBe(0); }
/// <summary> /// Use a baseline, either by name or by path. /// </summary> public void UseBaseline(BaselineOption baseline) { if (baseline == null) { return; } _Baseline = baseline; }
public int RunBaselineOption(BaselineOption opts) { try { throw new NotImplementedException("Not yet implemented, stay tune!"); } catch (Exception ex) { return(OnException(ex, "Failed to execute baseline function", opts.Debug, _traceService)); } }
public int RunBaselineOption(BaselineOption opts) { try { throw new NotImplementedException("Not yet implemented, stay tune!"); } catch (Exception ex) { _traceService.Error($"Failed to execute info function. {Environment.NewLine}{ex.ToString()}"); return(1); } }
public void Test_Baseline_Option_Throws_Not_Implemented_Exception() { //arrange var traceService = new Mock <ITraceService>(); var environmentService = new Mock <IEnvironmentService>(); var localVersionService = new Mock <ILocalVersionService>(); var migrationService = new Mock <IMigrationService>(); var migrationServiceFactory = new Mock <CLI.IMigrationServiceFactory>(); migrationServiceFactory.Setup(s => s.Create("sqlserver")).Returns(migrationService.Object); //act Assert.ThrowsException <NotImplementedException>(() => { var option = new BaselineOption { }; var sut = new CommandLineService(migrationServiceFactory.Object, localVersionService.Object, environmentService.Object, traceService.Object); sut.RunBaselineOption(option); }); }
public object RunBaselineOption(BaselineOption opts) { throw new NotImplementedException("Not yet implemented, stay tune!"); }
/// <summary> /// Create command for instantiation of specific template. /// </summary> /// <exception cref="InvalidTemplateParametersException">when <paramref name="template"/> has invalid template parameters.</exception> public TemplateCommand( BaseCommand instantiateCommand, IEngineEnvironmentSettings environmentSettings, TemplatePackageManager templatePackageManager, TemplateGroup templateGroup, CliTemplateInfo template, bool buildDefaultLanguageValidation = false) : base( templateGroup.ShortNames[0], template.Name + Environment.NewLine + template.Description) { _instantiateCommand = instantiateCommand; _environmentSettings = environmentSettings; _templatePackageManager = templatePackageManager; _templateGroup = templateGroup; _template = template; foreach (var item in templateGroup.ShortNames.Skip(1)) { AddAlias(item); } this.AddOption(OutputOption); this.AddOption(NameOption); this.AddOption(DryRunOption); this.AddOption(ForceOption); this.AddOption(NoUpdateCheckOption); string?templateLanguage = template.GetLanguage(); string?defaultLanguage = environmentSettings.GetDefaultLanguage(); if (!string.IsNullOrWhiteSpace(templateLanguage)) { LanguageOption = SharedOptionsFactory.CreateLanguageOption(); LanguageOption.Description = SymbolStrings.TemplateCommand_Option_Language; LanguageOption.FromAmongCaseInsensitive(new[] { templateLanguage }); if (!string.IsNullOrWhiteSpace(defaultLanguage) && buildDefaultLanguageValidation) { LanguageOption.SetDefaultValue(defaultLanguage); LanguageOption.AddValidator(optionResult => { var value = optionResult.GetValueOrDefault <string>(); if (value != template.GetLanguage()) { optionResult.ErrorMessage = "Languages don't match"; } } ); } this.AddOption(LanguageOption); } string?templateType = template.GetTemplateType(); if (!string.IsNullOrWhiteSpace(templateType)) { TypeOption = SharedOptionsFactory.CreateTypeOption(); TypeOption.Description = SymbolStrings.TemplateCommand_Option_Type; TypeOption.FromAmongCaseInsensitive(new[] { templateType }); this.AddOption(TypeOption); } if (template.BaselineInfo.Any(b => !string.IsNullOrWhiteSpace(b.Key))) { BaselineOption = SharedOptionsFactory.CreateBaselineOption(); BaselineOption.Description = SymbolStrings.TemplateCommand_Option_Baseline; BaselineOption.FromAmongCaseInsensitive(template.BaselineInfo.Select(b => b.Key).Where(b => !string.IsNullOrWhiteSpace(b)).ToArray()); this.AddOption(BaselineOption); } if (HasRunScriptPostActionDefined(template)) { AllowScriptsOption = new Option <AllowRunScripts>("--allow-scripts") { Description = SymbolStrings.TemplateCommand_Option_AllowScripts, Arity = new ArgumentArity(1, 1) }; AllowScriptsOption.SetDefaultValue(AllowRunScripts.Prompt); this.AddOption(AllowScriptsOption); } AddTemplateOptionsToCommand(template); }