public void ValidatePath_EmptyString_Invalid() { //Arrange IFolder dirManager = Helpers.CreateStubHelpers.GetIFolderStub(); IPathValidation controller = new PathValidation(s => dirManager, GetMockOperatingSystemVersion()); //Act String errorMessage; Boolean valid = controller.ValidPath(String.Empty, out errorMessage); //Assert Assert.IsFalse(valid); Assert.IsNotEmpty(errorMessage); }
public void ValidatePath_DriveHasColonPathDoesnContainAnyIllegalCharacters_Valid() { //MSDN states that : is illegal and is returned so need to check that when a drive is there it is still valid //Arrange IFolder dirManager = Helpers.CreateStubHelpers.GetIDirectoryManagerStub(new Char[] { '|', '?', ':' }); IPathValidation controller = new PathValidation(s => dirManager, GetMockOperatingSystemVersion()); //Act String errorMessage; Boolean valid = controller.ValidPath(m_Path, out errorMessage); //Assert Assert.IsTrue(valid); Assert.IsEmpty(errorMessage); }
public void ValidatePath_GreaterThanMaxPath_Invalid() { //Arrange IFolder dirManager = Helpers.CreateStubHelpers.GetIDirectoryManagerStub(1); IPathValidation controller = new PathValidation(s => dirManager, GetMockOperatingSystemVersion()); String longPath = @"c:\testPathThatIsLongerTheDirManagerAllows"; //Act String errorMessage; Boolean valid = controller.ValidPath(longPath, out errorMessage); //Assert Assert.IsFalse(valid); Assert.IsNotEmpty(errorMessage); }
public void ValidatePath_UNCPathOnXp_Invalid() { //Arrange IFolder dirManager = Helpers.CreateStubHelpers.GetIFolderStub(); IPathValidation controller = new PathValidation(s => dirManager, GetMockOperatingSystemVersion(isVista:false)); //Act String errorMsg; Boolean valid = controller.ValidPath(@"\\network\share", out errorMsg); //Assert Assert.IsFalse(valid); Assert.IsNotEmpty(errorMsg); }
public void ValidatePath_PathContainsIllegalCharacter_Invalid() { //Arrange IFolder dirManager = Helpers.CreateStubHelpers.GetIDirectoryManagerStub(new Char[] { '|', '?', ':' }); IPathValidation controller = new PathValidation(s => dirManager, GetMockOperatingSystemVersion()); //Act String errorMessage; Boolean valid = controller.ValidPath(GetPathAddingChar('|'), out errorMessage); //Assert Assert.IsFalse(valid); Assert.IsNotEmpty(errorMessage); }