public void ValidatePattern_ValidInput_ValidationSuceeds() { bool result = Utils.ValidatePattern(@"C:\foo\Bar.exe", out string errorMessage); result.Should().BeTrue(); errorMessage.Should().BeNullOrEmpty(); }
public void ValidatePattern_LocalFile_PathPartReported() { bool result = Utils.ValidatePattern(@"InvalidPath::\Foo.exe", out string errorMessage); result.Should().BeFalse(); errorMessage.Should().NotContain("file pattern part"); errorMessage.Should().Contain("path part"); }
public void ValidatePattern_TempDir_FilePartReported() { bool result = Utils.ValidatePattern(Path.GetTempPath(), out string errorMessage); result.Should().BeFalse(); errorMessage.Should().Contain("file pattern part"); errorMessage.Should().NotContain("path part"); }
public void ValidatePattern_EmptyPattern_BothPartsReported() { bool result = Utils.ValidatePattern("", out string errorMessage); result.Should().BeFalse(); errorMessage.Should().Contain("file pattern part"); errorMessage.Should().Contain("path part"); }
public void ValidatePattern_InvalidPattern_BothPartsReported() { char[] invalidPathChars = Path.GetInvalidPathChars(); if (invalidPathChars.Length < 1) { Assert.Inconclusive("Cannot test invalid path chars as none are reported."); } bool result = Utils.ValidatePattern("" + invalidPathChars[0], out string errorMessage); result.Should().BeFalse(); errorMessage.Should().Contain("file pattern part"); errorMessage.Should().Contain("path part"); }