public void Modify_ArgumentNullException_Model() { // Arrange IScriptModifier modifier = new TrackDacpacVersionModifier(); // Act & Assert // ReSharper disable AssignNullToNotNullAttribute Assert.Throws <ArgumentNullException>(() => modifier.ModifyAsync(null)); // ReSharper restore AssignNullToNotNullAttribute }
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 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); }