Пример #1
0
        public void ValidateSharedDacpacRepositoryPath_NoErrors()
        {
            // Arrange
            var model = new ConfigurationModel
            {
                SharedDacpacRepositoryPath = @"C:\Test\Repository\"
            };

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

            // Assert
            Assert.IsNotNull(errors);
            Assert.AreEqual(0, errors.Count);
        }
Пример #2
0
        public void ValidateSharedDacpacRepositoryPath_NoErrors_EmptyPath(string path)
        {
            // Arrange
            var model = new ConfigurationModel
            {
                SharedDacpacRepositoryPath = path
            };

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

            // Assert
            Assert.IsNotNull(errors);
            Assert.AreEqual(0, errors.Count);
        }
Пример #3
0
        public void ValidateSharedDacpacRepositoryPath_Errors_NoAbsolutePath()
        {
            // Arrange
            var model = new ConfigurationModel
            {
                SharedDacpacRepositoryPath = @"..\Repository"
            };

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

            // Assert
            Assert.IsNotNull(errors);
            Assert.AreEqual(1, errors.Count);
            Assert.AreEqual("Path must be an absolute path.", errors[0]);
        }
Пример #4
0
        public void ValidateSharedDacpacRepositoryPath_Errors_MustBeDirectory(string path)
        {
            // Arrange
            var model = new ConfigurationModel
            {
                SharedDacpacRepositoryPath = path
            };

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

            // Assert
            Assert.IsNotNull(errors);
            Assert.AreEqual(1, errors.Count);
            Assert.AreEqual("Path must be a directory.", errors[0]);
        }
Пример #5
0
        public void ValidateSharedDacpacRepositoryPath_Errors_InvalidCharacters()
        {
            // Arrange
            var model = new ConfigurationModel
            {
                SharedDacpacRepositoryPath = "C:\\" + new string(Path.GetInvalidPathChars()) + "\\Test\\"
            };

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

            // Assert
            Assert.IsNotNull(errors);
            Assert.AreEqual(1, errors.Count);
            Assert.AreEqual("Path contains invalid characters.", errors[0]);
        }
Пример #6
0
 public void ValidateSharedDacpacRepositoryPath_ArgumentNullException_Model()
 {
     // Act & Assert
     // ReSharper disable once AssignNullToNotNullAttribute
     Assert.Throws <ArgumentNullException>(() => ConfigurationModelValidations.ValidateSharedDacpacRepositoryPath(null));
 }