From 7a3dc8e9603673b604d2c325076b7f27cd563d8b Mon Sep 17 00:00:00 2001 From: Thomas Broust Date: Fri, 4 Jul 2014 22:49:13 +0200 Subject: [PATCH] Tests a few more string extensions Former-commit-id: df69ccf584bf3b30433e2ee51808aeaf471d2fb3 --- .../Extensions/StringExtensionsUnitTests.cs | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/ImageProcessor.UnitTests/Extensions/StringExtensionsUnitTests.cs b/src/ImageProcessor.UnitTests/Extensions/StringExtensionsUnitTests.cs index 17cc4c753..70f3e83db 100644 --- a/src/ImageProcessor.UnitTests/Extensions/StringExtensionsUnitTests.cs +++ b/src/ImageProcessor.UnitTests/Extensions/StringExtensionsUnitTests.cs @@ -124,5 +124,45 @@ namespace ImageProcessor.UnitTests Assert.AreEqual(item.Value, result); } } + + /// + /// Tests if the value is a valid URI + /// + /// The value to test + /// Whether the value is correct + /// + /// The full RFC3986 does not seem to pass the test with the square brackets + /// + [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); + } } } \ No newline at end of file