Example #1
0
        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);
        }
Example #2
0
        public void Modify_ArgumentNullException_Model()
        {
            // Arrange
            IScriptModifier s = new AddCustomHeaderModifier();

            // Act & Assert
            // ReSharper disable AssignNullToNotNullAttribute
            Assert.Throws <ArgumentNullException>(() => s.ModifyAsync(null));
            // ReSharper restore AssignNullToNotNullAttribute
        }
Example #3
0
        public async Task Modify_NoLeadingNewLineWhenNullOrWhiteSpace_Async(string customHeader)
        {
            // Arrange
            IScriptModifier s             = new AddCustomHeaderModifier();
            const string    input         = "foobar";
            var             project       = new SqlProject("a", "b", "c");
            var             configuration = new ConfigurationModel
            {
                CustomHeader = customHeader
            };
            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);
        }