Пример #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);
        }
Пример #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]);
        }
Пример #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]);
        }
Пример #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]);
        }
Пример #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]);
        }
Пример #6
0
 public void ValidatePublishProfilePath_ArgumentNullException_Model()
 {
     // Act & Assert
     // ReSharper disable once AssignNullToNotNullAttribute
     Assert.Throws <ArgumentNullException>(() => ConfigurationModelValidations.ValidatePublishProfilePath(null));
 }