コード例 #1
0
        public void CheckPathsAreValid_ShouldThrow()
        {
            //Invalid path
            var p = new PathsValidator(new ServiceControlInstanceMetadata {
                InstallPath = @"?>c:\test\1\bin"
            })
            {
                Instances = instances
            };
            var ex = Assert.Throws <EngineValidationException>(() => p.CheckPathsAreValid());

            Assert.That(ex.Message, Is.EqualTo("The install path is set to an invalid path"));

            //Partial path
            p = new PathsValidator(new ServiceControlInstanceMetadata {
                InstallPath = @"\test\1\bin"
            })
            {
                Instances = instances
            };

            ex = Assert.Throws <EngineValidationException>(() => p.CheckPathsAreValid());
            Assert.That(ex.Message, Is.EqualTo("The install path is set to an invalid path"));

            //No Drive
            p = new PathsValidator(new ServiceControlInstanceMetadata {
                InstallPath = $@"{GetAnUnsedDriveLetter()}:\test\1\bin"
            })
            {
                Instances = instances
            };
            ex = Assert.Throws <EngineValidationException>(() => p.CheckPathsAreValid());
            Assert.That(ex.Message, Is.EqualTo("The install path does not go to a supported drive"));
        }
コード例 #2
0
        public void CheckPathsAreValid_ShouldSucceed()
        {
            var newInstance = new ServiceControlNewInstance
            {
                InstallPath = @"c:\test\1\bin",
                LogPath     = @"c:\test\1\bin",
                DBPath      = @"c:\test\1\bin"
            };

            var p = new PathsValidator(newInstance);

            Assert.DoesNotThrow(() => p.CheckPathsAreValid());
        }