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")); }
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()); }