public async Task Modify_ReplaceSpecialKeyword_PreviousVersion_Async() { // Arrange IScriptModifier s = new AddCustomHeaderModifier(); const string input = "foobar"; var project = new SqlProject("a", "b", "c"); project.ProjectProperties.DacVersion = new Version(1, 3, 0); var configuration = new ConfigurationModel { CustomHeader = "Script base version: {PREVIOUS_VERSION}" }; var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); var sourcePaths = new DeploySourcePaths("newDacpacPath", "publishProfilePath", "previousDacpacPath"); var targetPaths = new DeployTargetPaths("deployScriptPath", "deployReportPath"); var paths = new PathCollection(directories, sourcePaths, targetPaths); var model = new ScriptModificationModel(input, project, configuration, paths, new Version(1, 2, 0), false); // Act await s.ModifyAsync(model); // Assert Assert.IsNotNull(model.CurrentScript); Assert.AreEqual("Script base version: 1.2.0\r\nfoobar", model.CurrentScript); }
public async Task Work_ScriptCreationStateModel_CompleteRun_NoFilesDeleted_ConfigurationDisabled_Async() { // Arrange var fsaMock = new Mock <IFileSystemAccess>(); var vsaMock = new Mock <IVisualStudioAccess>(); var loggerMock = new Mock <ILogger>(); IWorkUnit <ScriptCreationStateModel> unit = new DeleteRefactorLogUnit(fsaMock.Object, vsaMock.Object, loggerMock.Object); var project = new SqlProject("a", "b", "c"); var configuration = ConfigurationModel.GetDefault(); configuration.DeleteRefactorlogAfterVersionedScriptGeneration = false; var previousVersion = new Version(1, 0); Task HandlerFunc(bool b) => Task.CompletedTask; var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); var sourcePaths = new DeploySourcePaths("newDacpacPath", "publishProfilePath", "previousDacpacPath"); var targetPaths = new DeployTargetPaths("deployScriptPath", "deployReportPath"); var paths = new PathCollection(directories, sourcePaths, targetPaths); var model = new ScriptCreationStateModel(project, configuration, previousVersion, true, HandlerFunc) { Paths = paths }; // Act await unit.Work(model, CancellationToken.None); // Assert Assert.AreEqual(StateModelState.DeletedRefactorLog, model.CurrentState); Assert.IsNull(model.Result); fsaMock.Verify(m => m.TryToCleanDirectory(It.IsAny <string>(), It.IsAny <string>()), Times.Never); vsaMock.Verify(m => m.RemoveItemFromProjectRoot(project, It.IsAny <string>()), Times.Never); loggerMock.Verify(m => m.LogInfoAsync(It.IsAny <string>()), Times.Never); loggerMock.Verify(m => m.LogTraceAsync(It.IsAny <string>()), Times.Never); }
public async Task Work_ScaffoldingStateModel_LoadedSuccessful_Async() { // Arrange var project = new SqlProject("a", "b", "c"); var configuration = ConfigurationModel.GetDefault(); var targetVersion = new Version(1, 2, 3); Task HandleWorkInProgressChanged(bool arg) => Task.CompletedTask; var model = new ScaffoldingStateModel(project, configuration, targetVersion, HandleWorkInProgressChanged); var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); var sourcePaths = new DeploySourcePaths("newDacpacPath", "publishProfilePath", "previousDacpacPath"); var targetPaths = new DeployTargetPaths("deployScriptPath", "deployReportPath"); var paths = new PathCollection(directories, sourcePaths, targetPaths); var spsMock = new Mock <ISqlProjectService>(); spsMock.Setup(m => m.TryLoadPathsForScaffoldingAsync(project, configuration)).ReturnsAsync(paths); IWorkUnit <ScaffoldingStateModel> unit = new LoadPathsUnit(spsMock.Object); // Act await unit.Work(model, CancellationToken.None); // Assert Assert.AreEqual(StateModelState.PathsLoaded, model.CurrentState); Assert.IsNull(model.Result); }
public async Task Work_ScriptCreationStateModel_VerificationFailed_PublishProfilePathIsNotFilled_Async() { // Arrange var project = new SqlProject("a", "b", "c"); var configuration = ConfigurationModel.GetDefault(); var previousVersion = new Version(1, 0); Task HandleWorkInProgressChanged(bool arg) => Task.CompletedTask; var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); var sourcePaths = new DeploySourcePaths("newDacpacPath", "", "previousDacpacPath"); var targetPaths = new DeployTargetPaths("deployScriptPath", "deployReportPath"); var paths = new PathCollection(directories, sourcePaths, targetPaths); var model = new ScriptCreationStateModel(project, configuration, previousVersion, true, HandleWorkInProgressChanged) { Paths = paths }; var fsaMock = new Mock <IFileSystemAccess>(); var loggerMock = new Mock <ILogger>(); loggerMock.SetupGet(m => m.DocumentationBaseUrl).Returns("foobasebar"); IWorkUnit <ScriptCreationStateModel> unit = new VerifyPathsUnit(fsaMock.Object, loggerMock.Object); // Act await unit.Work(model, CancellationToken.None); // Assert Assert.AreEqual(StateModelState.PathsVerified, model.CurrentState); Assert.IsFalse(model.Result); loggerMock.Verify(m => m.LogErrorAsync(It.Is <string>(s => s.Contains(ConfigurationModel.UseSinglePublishProfileSpecialKeyword) && s.Contains("foobasebarpublish-profile-path"))), Times.Once); fsaMock.Verify(m => m.CheckIfFileExists(It.IsAny <string>()), Times.Never); }
public void Constructor_ArgumentNullException_DeploySources() { // Arrange var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); // Act & Assert // ReSharper disable once ObjectCreationAsStatement // ReSharper disable AssignNullToNotNullAttribute Assert.Throws <ArgumentNullException>(() => new PathCollection(directories, null, null)); // ReSharper restore AssignNullToNotNullAttribute }
public void Constructor_NoInvalidOperationException_NeitherScriptPathNorDeployPathSet_WhenPreviousDacpacPathIsNotSet() { // Arrange var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); var sourcePaths = new DeploySourcePaths("newDacpacPath", "publishProfilePath", null); var targetPaths = new DeployTargetPaths(null, null); // Act & Assert // ReSharper disable once ObjectCreationAsStatement Assert.DoesNotThrow(() => new PathCollection(directories, sourcePaths, targetPaths)); }
public async Task ModifyAsync_ErrorsGettingDacpacConstraints_Async() { // Arrange var daMock = new Mock <IDacAccess>(); var loggerMock = new Mock <ILogger>(); daMock.Setup(m => m.GetDefaultConstraintsAsync("previousDacpacPath")) .ReturnsAsync(() => (new DefaultConstraint[0], new [] { "oldError1", "oldError2" })); daMock.Setup(m => m.GetDefaultConstraintsAsync("newDacpacPath")) .ReturnsAsync(() => (new DefaultConstraint[0], new[] { "newError1", "newError2" })); var project = new SqlProject("a", "b", "c"); var config = new ConfigurationModel { ArtifactsPath = "foobar", ReplaceUnnamedDefaultConstraintDrops = true, CommentOutUnnamedDefaultConstraintDrops = false, PublishProfilePath = "Test.publish.xml", VersionPattern = "1.2.3.4", CreateDocumentationWithScriptCreation = true, CustomHeader = "awesome header", CustomFooter = "lame footer", BuildBeforeScriptCreation = true, TrackDacpacVersion = false }; var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); var sourcePaths = new DeploySourcePaths("newDacpacPath", "publishProfilePath", "previousDacpacPath"); var targetPaths = new DeployTargetPaths("deployScriptPath", "deployReportPath"); var paths = new PathCollection(directories, sourcePaths, targetPaths); IScriptModifier modifier = new ReplaceUnnamedDefaultConstraintDropsModifier(daMock.Object, loggerMock.Object); var model = new ScriptModificationModel(MultipleDropDefaultConstraintStatements, project, config, paths, new Version(1, 0, 0), false); // Act await modifier.ModifyAsync(model); // Assert Assert.AreEqual(MultipleDropDefaultConstraintStatements, model.CurrentScript); loggerMock.Verify(m => m.LogErrorAsync("Failed to load the default constraints of the previous DACPAC:"), Times.Once); loggerMock.Verify(m => m.LogErrorAsync("oldError1"), Times.Once); loggerMock.Verify(m => m.LogErrorAsync("oldError2"), Times.Once); loggerMock.Verify(m => m.LogErrorAsync("Failed to load the default constraints of the current DACPAC:"), Times.Once); loggerMock.Verify(m => m.LogErrorAsync("newError1"), Times.Once); loggerMock.Verify(m => m.LogErrorAsync("newError2"), Times.Once); }
public string Directory(DirectoryPaths toCheck) { if (toCheck == DirectoryPaths.COUNT) { return(""); } ScriptSection dirSection = FindSection("directories"); if (dirSection != null) { string sRoot = dirSection.FindTag("DIRECTORY"); string partialPath = ""; if (toCheck == DirectoryPaths.Root) { return(sRoot); } switch (toCheck) { case DirectoryPaths.Dictionaries: partialPath = dirSection.FindTag("DICTIONARYDIRECTORY"); break; case DirectoryPaths.Definitions: partialPath = dirSection.FindTag("DEFSDIRECTORY"); break; case DirectoryPaths.Accounts: partialPath = dirSection.FindTag("ACTSDIRECTORY"); break; default: partialPath = dirSection.FindTag(toCheck.ToString().ToUpper() + "DIRECTORY"); break; } if (partialPath == "") { return(""); } if (partialPath.StartsWith("./")) { string builtPath = sRoot; builtPath = builtPath.Replace("\\", "/"); if (!builtPath.EndsWith("/")) { builtPath += "/"; } builtPath += partialPath.Substring(2); return(builtPath); } else { return(partialPath); } } else { return(""); } }
private void CopySubDirectories(string sourcePath) { var subDirs = new DirectoryInfo(sourcePath).GetDirectories(); foreach (var dir in subDirs) { var targetPath = _directoryPaths.TargetPath + @"\" + dir.Name; var sourcePaths = new List <string> { dir.FullName }; var subDirectoryPaths = new DirectoryPaths(targetPath, sourcePaths); new FileCopier(subDirectoryPaths).Copy(); } }
public async Task Work_ScriptCreationStateModel_CreateScriptAndReport_Async(bool includePreDeployment, bool includePostDeployment) { // Arrange var daMock = new Mock <IDacAccess>(); daMock.Setup(m => m.CreateDeployFilesAsync("previousDacpacPath", "newDacpacPath", "publishProfilePath", true, true)) .ReturnsAsync(new CreateDeployFilesResult((includePreDeployment ? "pre " : "") + "script" + (includePostDeployment ? " post" : ""), "report", includePreDeployment ? "pre " : null, includePostDeployment ? " post" : null, new PublishProfile())); var fsaMock = new Mock <IFileSystemAccess>(); var loggerMock = new Mock <ILogger>(); IWorkUnit <ScriptCreationStateModel> unit = new CreateDeploymentFilesUnit(daMock.Object, fsaMock.Object, loggerMock.Object); var project = new SqlProject("a", "b", "c"); var configuration = ConfigurationModel.GetDefault(); configuration.CreateDocumentationWithScriptCreation = true; var previousVersion = new Version(1, 0); Task HandlerFunc(bool b) => Task.CompletedTask; var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); var sourcePaths = new DeploySourcePaths("newDacpacPath", "publishProfilePath", "previousDacpacPath"); var targetPaths = new DeployTargetPaths("deployScriptPath", "deployReportPath"); var paths = new PathCollection(directories, sourcePaths, targetPaths); var model = new ScriptCreationStateModel(project, configuration, previousVersion, false, HandlerFunc) { Paths = paths }; // Act await unit.Work(model, CancellationToken.None); // Assert Assert.AreEqual(StateModelState.TriedToCreateDeploymentFiles, model.CurrentState); Assert.IsNull(model.Result); fsaMock.Verify(m => m.WriteFileAsync(It.IsAny <string>(), It.IsAny <string>()), Times.Exactly(2)); fsaMock.Verify(m => m.WriteFileAsync("deployScriptPath", (includePreDeployment ? "pre " : "") + "script" + (includePostDeployment ? " post" : "")), Times.Once); fsaMock.Verify(m => m.WriteFileAsync("deployReportPath", "report"), Times.Once); loggerMock.Verify(m => m.LogDebugAsync("Previous DACPAC path: \"previousDacpacPath\""), Times.Once); loggerMock.Verify(m => m.LogDebugAsync("New DACPAC path: \"newDacpacPath\""), Times.Once); loggerMock.Verify(m => m.LogDebugAsync("Publish profile path: \"publishProfilePath\""), Times.Once); loggerMock.Verify(m => m.LogDebugAsync(It.Is <string>(s => s.StartsWith("Current working directory: \"") && s.EndsWith("\""))), Times.Once); loggerMock.Verify(m => m.LogErrorAsync(It.IsAny <string>()), Times.Never); loggerMock.Verify(m => m.LogErrorAsync(It.IsAny <Exception>(), It.IsAny <string>()), Times.Never); }
public async Task ModifyAsync_CorrectReplacement_OneRegexTimeout_Async() { // Arrange var schemaName = new string('a', 1_000_000) + '.'; var input = string.Format(MultipleDropDefaultConstraintStatementsWithPlaceholder, schemaName); var expectedOutput = string.Format(MultipleDropDefaultConstraintStatementsReplacedPartiallyWithPlaceholder, schemaName); var daMock = new Mock <IDacAccess>(); var loggerMock = new Mock <ILogger>(); daMock.Setup(m => m.GetDefaultConstraintsAsync("previousDacpacPath")) .ReturnsAsync(() => (new[] { new DefaultConstraint("dbo", "Author", "LastName", null), new DefaultConstraint("dbo", "Book", "Title", null), new DefaultConstraint("dbo", "Book", "RegisteredDate", "DF_RegisteredDate_Today") }, null)); daMock.Setup(m => m.GetDefaultConstraintsAsync("newDacpacPath")) .ReturnsAsync(() => (new DefaultConstraint[0], null)); var project = new SqlProject("a", "b", "c"); var config = new ConfigurationModel { ArtifactsPath = "foobar", ReplaceUnnamedDefaultConstraintDrops = true, CommentOutUnnamedDefaultConstraintDrops = false, PublishProfilePath = "Test.publish.xml", VersionPattern = "1.2.3.4", CreateDocumentationWithScriptCreation = true, CustomHeader = "awesome header", CustomFooter = "lame footer", BuildBeforeScriptCreation = true, TrackDacpacVersion = false }; var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); var sourcePaths = new DeploySourcePaths("newDacpacPath", "publishProfilePath", "previousDacpacPath"); var targetPaths = new DeployTargetPaths("deployScriptPath", "deployReportPath"); var paths = new PathCollection(directories, sourcePaths, targetPaths); IScriptModifier modifier = new ReplaceUnnamedDefaultConstraintDropsModifier(daMock.Object, loggerMock.Object); var model = new ScriptModificationModel(input, project, config, paths, new Version(1, 0, 0), false); // Act await modifier.ModifyAsync(model); // Assert Assert.AreEqual(expectedOutput, model.CurrentScript); loggerMock.Verify(m => m.LogWarningAsync($"{nameof(ReplaceUnnamedDefaultConstraintDropsModifier)}: Regular expression matching timed out 1 time(s)."), Times.Once); }
public void Constructor_CorrectSettingOfProperties(bool setDeployScriptPath, bool setDeployReportPath) { // Arrange var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); var sourcePaths = new DeploySourcePaths("newDacpacPath", "publishProfilePath", "previousDacpacPath"); var targetPaths = new DeployTargetPaths(setDeployScriptPath ? "deployScriptPath" : null, setDeployReportPath ? "deployReportPath" : null); // Act var pc = new PathCollection(directories, sourcePaths, targetPaths); // Assert Assert.AreSame(directories, pc.Directories); Assert.AreSame(sourcePaths, pc.DeploySources); Assert.AreSame(targetPaths, pc.DeployTargets); }
public async Task Modify_CorrectModification_Async() { // Arrange IScriptModifier modifier = new CommentOutUnnamedDefaultConstraintDropsModifier(); var project = new SqlProject("", "", ""); var configuration = new ConfigurationModel(); var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); var sourcePaths = new DeploySourcePaths("newDacpacPath", "publishProfilePath", "previousDacpacPath"); var targetPaths = new DeployTargetPaths("deployScriptPath", "deployReportPath"); var paths = new PathCollection(directories, sourcePaths, targetPaths); var model = new ScriptModificationModel(MultipleDropDefaultConstraintStatements, project, configuration, paths, new Version(1, 0, 0), false); // Act await modifier.ModifyAsync(model); // Assert Assert.AreEqual(MultipleDropDefaultConstraintStatementsCommented, model.CurrentScript); }
public void Modify_ArgumentException_ProjectPropertiesSqlTargetNameNull() { // Arrange IScriptModifier modifier = new TrackDacpacVersionModifier(); var project = new SqlProject("", "", ""); var configuration = new ConfigurationModel(); var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); var sourcePaths = new DeploySourcePaths("newDacpacPath", "publishProfilePath", "previousDacpacPath"); var targetPaths = new DeployTargetPaths("deployScriptPath", "deployReportPath"); var paths = new PathCollection(directories, sourcePaths, targetPaths); var model = new ScriptModificationModel(MultiLineInputWithFinalGo, project, configuration, paths, new Version(1, 0, 0), false); // Act var e = Assert.Throws <ArgumentException>(() => modifier.ModifyAsync(model)); // Assert Assert.IsNotNull(e); Assert.IsTrue(e.Message.Contains(nameof(SqlProjectProperties.SqlTargetName))); }
public async Task ModifyAsync_CorrectReplacement_Async() { // Arrange var daMock = new Mock <IDacAccess>(); var loggerMock = new Mock <ILogger>(); daMock.Setup(m => m.GetDefaultConstraintsAsync("previousDacpacPath")) .ReturnsAsync(() => (new[] { new DefaultConstraint("dbo", "Author", "LastName", null), new DefaultConstraint("dbo", "Book", "Title", null), new DefaultConstraint("dbo", "Book", "RegisteredDate", "DF_RegisteredDate_Today") }, null)); daMock.Setup(m => m.GetDefaultConstraintsAsync("newDacpacPath")) .ReturnsAsync(() => (new DefaultConstraint[0], null)); var project = new SqlProject("a", "b", "c"); var config = new ConfigurationModel { ArtifactsPath = "foobar", ReplaceUnnamedDefaultConstraintDrops = true, CommentOutUnnamedDefaultConstraintDrops = false, PublishProfilePath = "Test.publish.xml", VersionPattern = "1.2.3.4", CreateDocumentationWithScriptCreation = true, CustomHeader = "awesome header", CustomFooter = "lame footer", BuildBeforeScriptCreation = true, TrackDacpacVersion = false }; var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); var sourcePaths = new DeploySourcePaths("newDacpacPath", "publishProfilePath", "previousDacpacPath"); var targetPaths = new DeployTargetPaths("deployScriptPath", "deployReportPath"); var paths = new PathCollection(directories, sourcePaths, targetPaths); IScriptModifier modifier = new ReplaceUnnamedDefaultConstraintDropsModifier(daMock.Object, loggerMock.Object); var model = new ScriptModificationModel(MultipleDropDefaultConstraintStatements, project, config, paths, new Version(1, 0, 0), false); // Act await modifier.ModifyAsync(model); // Assert Assert.AreEqual(MultipleDropDefaultConstraintStatementsReplaced, model.CurrentScript); }
public async Task Work_ScriptCreationStateModel_PersistReportError_Async() { // Arrange var testException = new Exception("test exception"); var daMock = new Mock <IDacAccess>(); daMock.Setup(m => m.CreateDeployFilesAsync("previousDacpacPath", "newDacpacPath", "publishProfilePath", true, true)) .ReturnsAsync(new CreateDeployFilesResult("pre script post", "report", "pre ", " post", new PublishProfile())); var fsaMock = new Mock <IFileSystemAccess>(); fsaMock.Setup(m => m.WriteFileAsync("deployReportPath", "report")) .ThrowsAsync(testException); var loggerMock = new Mock <ILogger>(); IWorkUnit <ScriptCreationStateModel> unit = new CreateDeploymentFilesUnit(daMock.Object, fsaMock.Object, loggerMock.Object); var project = new SqlProject("a", "b", "c"); var configuration = ConfigurationModel.GetDefault(); configuration.CreateDocumentationWithScriptCreation = true; var previousVersion = new Version(1, 0); Task HandlerFunc(bool b) => Task.CompletedTask; var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); var sourcePaths = new DeploySourcePaths("newDacpacPath", "publishProfilePath", "previousDacpacPath"); var targetPaths = new DeployTargetPaths("deployScriptPath", "deployReportPath"); var paths = new PathCollection(directories, sourcePaths, targetPaths); var model = new ScriptCreationStateModel(project, configuration, previousVersion, false, HandlerFunc) { Paths = paths }; // Act await unit.Work(model, CancellationToken.None); // Assert Assert.AreEqual(StateModelState.TriedToCreateDeploymentFiles, model.CurrentState); Assert.IsFalse(model.Result); fsaMock.Verify(m => m.WriteFileAsync(It.IsAny <string>(), It.IsAny <string>()), Times.Exactly(2)); loggerMock.Verify(m => m.LogErrorAsync("Script creation aborted."), Times.Once); loggerMock.Verify(m => m.LogErrorAsync(testException, "Failed to write deploy report"), Times.Once); }
public async Task Modify_CorrectModification_MajorMinorVersion_Async(string input) { // Arrange IScriptModifier modifier = new TrackDacpacVersionModifier(); var project = new SqlProject("", "", ""); project.ProjectProperties.SqlTargetName = "Database.TestProject"; project.ProjectProperties.DacVersion = new Version(500, 30); var configuration = new ConfigurationModel(); var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); var sourcePaths = new DeploySourcePaths("newDacpacPath", "publishProfilePath", "previousDacpacPath"); var targetPaths = new DeployTargetPaths("deployScriptPath", "deployReportPath"); var paths = new PathCollection(directories, sourcePaths, targetPaths); var model = new ScriptModificationModel(input, project, configuration, paths, new Version(1, 0, 0), false); // Act await modifier.ModifyAsync(model); // Assert Assert.AreEqual(FinalMultilineStatementMajorMinorVersion, model.CurrentScript); }
public void StopClangCommand(bool backgroundRunners) { try { if (backgroundRunners == false) { StopCommandActivated = true; } if (runningProcesses.Exists(backgroundRunners) == false) { return; } runningProcesses.Kill(backgroundRunners); if (VsServiceProvider.TryGetService(typeof(DTE), out object dte)) { string solutionPath = (dte as DTE2).Solution.FullName; if (string.IsNullOrWhiteSpace(solutionPath)) { return; } string solutionFolder = solutionPath.Substring(0, solutionPath.LastIndexOf('\\')); mPCHCleaner.Remove(solutionFolder); } if (DirectoryPaths.Count > 0) { var tidyFileCleaner = new ClangTidyCleaner(); tidyFileCleaner.Remove(DirectoryPaths); DirectoryPaths.Clear(); } } catch (Exception e) { MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public async Task ModifyAsync_CorrectModification_Async(string input) { // Arrange IScriptModifier modifier = new RemoveSqlCmdStatementsModifier(); var project = new SqlProject("a", "b", "c"); project.ProjectProperties.DacVersion = new Version(1, 3, 0); var configuration = new ConfigurationModel { CustomFooter = "footer" }; var directories = new DirectoryPaths("projectDirectory", "latestArtifactsDirectory", "newArtifactsDirectory"); var sourcePaths = new DeploySourcePaths("newDacpacPath", "publishProfilePath", "previousDacpacPath"); var targetPaths = new DeployTargetPaths("deployScriptPath", "deployReportPath"); var paths = new PathCollection(directories, sourcePaths, targetPaths); var model = new ScriptModificationModel(input, project, configuration, paths, new Version(1, 2, 0), false); // Act await modifier.ModifyAsync(model); // Assert Assert.AreEqual(MultiLineInputWithoutSqlcmdStatements, model.CurrentScript); }