Example #1
0
        public void Build()
        {
            // Build first URL
            var result = UncPath.Build(@"C:", "Windows", @"\");

            // Expected result C:\Windows\
            Assert.AreEqual(@"C:\Windows\", result);
        }
Example #2
0
        public void GetApplicationDirectory()
        {
            // Make the call to  Utilities.IO.UncPath.GetApplicationDirectory()
            var result = UncPath.GetApplicationDirectory();

            // Ensure string is not empty
            Assert.AreNotEqual(string.Empty, result);

            // Ensure is valid UNC path format
            Assert.IsTrue(
                System.Text.RegularExpressions.Regex.IsMatch(
                    result,
                    "^((\\\\\\\\[a-zA-Z0-9-]+\\\\[a-zA-Z0-9`~!@#$%^&(){}//._-]+([ ]+[a-zA-Z0-9`~!@#$%^&(){}//._-]+)*)|([a-zA-Z]:))(\\\\[^ \\\\/:*?\"\"<>|]+([ ]+[^ \\\\/:*?\"\"<>|]+)*)*\\\\?$"));
        }
Example #3
0
        public void GetLeftmostnamespace()
        {
            // Test UNC path
            var result1 = UncPath.GetLeftmostnamespace("C:\\Windows\\", "\\");

            Assert.AreEqual(result1, "C:");

            // Test web address
            var result2 = UncPath.GetLeftmostnamespace("www.ryanpenfold.com", ".");

            Assert.AreEqual(result2, "www");

            // Test param
            var result3 = UncPath.GetLeftmostnamespace("param=value", "=");

            Assert.AreEqual(result3, "param");
        }