Browse Source

Tests a few more string extensions

Former-commit-id: 41f9f893d9696a9e3fa34b772cb5b13c38d54927
af/merge-core
Thomas Broust 12 years ago
parent
commit
9741bf8eef
  1. 40
      src/ImageProcessor.UnitTests/Extensions/StringExtensionsUnitTests.cs

40
src/ImageProcessor.UnitTests/Extensions/StringExtensionsUnitTests.cs

@ -124,5 +124,45 @@ namespace ImageProcessor.UnitTests
Assert.AreEqual(item.Value, result);
}
}
/// <summary>
/// Tests if the value is a valid URI
/// </summary>
/// <param name="input">The value to test</param>
/// <param name="expected">Whether the value is correct</param>
/// <remarks>
/// The full RFC3986 does not seem to pass the test with the square brackets
/// </remarks>
[Test]
[TestCase("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", true)]
[TestCase("-", true)]
[TestCase(".", true)]
[TestCase("_", true)]
[TestCase("~", true)]
[TestCase(":", true)]
[TestCase("/", true)]
[TestCase("?", true)]
[TestCase("#", true)]
[TestCase("[", false)]
[TestCase("]", false)]
[TestCase("@", true)]
[TestCase("!", true)]
[TestCase("$", true)]
[TestCase("&", true)]
[TestCase("'", true)]
[TestCase("(", true)]
[TestCase(")", true)]
[TestCase("*", true)]
[TestCase("+", true)]
[TestCase(",", true)]
[TestCase(";", true)]
[TestCase("=", true)]
[TestCase("lorem ipsum", false)]
[TestCase("é", false)]
public void TestIsValidUri(string input, bool expected)
{
var result = input.IsValidVirtualPathName();
Assert.AreEqual(expected, result);
}
}
}
Loading…
Cancel
Save