Ejemplo n.º 1
0
        public void ValidatePublishProfilePath_NoErrors(string publishProfilePath)
        {
            // Arrange
            var model = new ConfigurationModel
            {
                PublishProfilePath = publishProfilePath
            };

            // Act
            var errors = ConfigurationModelValidations.ValidatePublishProfilePath(model);

            // Assert
            Assert.IsNotNull(errors);
            Assert.AreEqual(0, errors.Count);
        }
Ejemplo n.º 2
0
        public void ValidatePublishProfilePath_Errors_NoRelativePath()
        {
            // Arrange
            var model = new ConfigurationModel
            {
                PublishProfilePath = @"C:\Temp\Database.publish.xml"
            };

            // Act
            var errors = ConfigurationModelValidations.ValidatePublishProfilePath(model);

            // Assert
            Assert.IsNotNull(errors);
            Assert.AreEqual(1, errors.Count);
            Assert.AreEqual("Path must be a relative path.", errors[0]);
        }
Ejemplo n.º 3
0
        public void ValidatePublishProfilePath_Errors_InvalidCharacters()
        {
            // Arrange
            var model = new ConfigurationModel
            {
                PublishProfilePath = new string(Path.GetInvalidPathChars()) + ".publish.xml"
            };

            // Act
            var errors = ConfigurationModelValidations.ValidatePublishProfilePath(model);

            // Assert
            Assert.IsNotNull(errors);
            Assert.AreEqual(1, errors.Count);
            Assert.AreEqual("Path contains invalid characters.", errors[0]);
        }
Ejemplo n.º 4
0
        [TestCase("Database.pub.xml")] // Wrong ending is not OK.
        public void ValidatePublishProfilePath_Errors_DoesNotEndCorrectly(string path)
        {
            // Arrange
            var model = new ConfigurationModel
            {
                PublishProfilePath = path
            };

            // Act
            var errors = ConfigurationModelValidations.ValidatePublishProfilePath(model);

            // Assert
            Assert.IsNotNull(errors);
            Assert.AreEqual(1, errors.Count);
            Assert.AreEqual("Profile file name must end with *.publish.xml.", errors[0]);
        }
Ejemplo n.º 5
0
        public void ValidatePublishProfilePath_Errors_EmptyPath(string path)
        {
            // Arrange
            var model = new ConfigurationModel
            {
                PublishProfilePath = path
            };

            // Act
            var errors = ConfigurationModelValidations.ValidatePublishProfilePath(model);

            // Assert
            Assert.IsNotNull(errors);
            Assert.AreEqual(1, errors.Count);
            Assert.AreEqual("Path cannot be empty.", errors[0]);
        }
Ejemplo n.º 6
0
 public void ValidatePublishProfilePath_ArgumentNullException_Model()
 {
     // Act & Assert
     // ReSharper disable once AssignNullToNotNullAttribute
     Assert.Throws <ArgumentNullException>(() => ConfigurationModelValidations.ValidatePublishProfilePath(null));
 }