public async Task Modify_ReplaceSpecialKeyword_PreviousVersion_Async() { // Arrange IScriptModifier s = new AddCustomFooterModifier(); const string input = "foobar"; var project = new SqlProject("a", "b", "c"); project.ProjectProperties.DacVersion = new Version(1, 3, 0); var configuration = new ConfigurationModel { CustomFooter = "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("foobar\r\nScript base version: 1.2.0", model.CurrentScript); }
public void Modify_ArgumentNullException_Model() { // Arrange IScriptModifier s = new AddCustomFooterModifier(); // Act & Assert // ReSharper disable AssignNullToNotNullAttribute Assert.Throws <ArgumentNullException>(() => s.ModifyAsync(null)); // ReSharper restore AssignNullToNotNullAttribute }
public async Task Modify_NoTrailingNewLineWhenNullOrWhiteSpace_Async(string customFooter) { // Arrange IScriptModifier s = new AddCustomFooterModifier(); const string input = "foobar"; var project = new SqlProject("a", "b", "c"); var configuration = new ConfigurationModel { CustomFooter = customFooter }; 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 s.ModifyAsync(model); // Assert Assert.IsNotNull(model.CurrentScript); Assert.AreEqual("foobar", model.CurrentScript); }