Example #1
0
        public void op_ToPath_FileSystemInfo_whenHttpQueryVerticalBar()
        {
            AbsoluteUri obj = "http://example.com/foo/bar?q=4|5";

            var expected = new DirectoryInfo(Path.Combine(Path.GetTempPath(), @"http\example.com\foo\bar?q=4|5"));
            var actual   = obj.ToPath(new DirectoryInfo(Path.GetTempPath()));

            Assert.Equal(expected.FullName, actual.FullName);
        }
Example #2
0
        public void op_ToPath_FileSystemInfo_whenHttpQueryBackslash()
        {
            AbsoluteUri obj = @"http://example.com/foo/bar?q=a\b";

            var expected = new DirectoryInfo(Path.Combine(Path.GetTempPath(), @"http\example.com\foo\bar?q=a\b"));
            var actual   = obj.ToPath(new DirectoryInfo(Path.GetTempPath()));

            Assert.Equal(expected.FullName, actual.FullName);
        }
Example #3
0
        public void op_ToPath_FileSystemInfo_whenUrn()
        {
            AbsoluteUri obj = "urn://example.com";

            var expected = new DirectoryInfo(Path.Combine(Path.GetTempPath(), @"urn\example.com\"));
            var actual   = obj.ToPath(new DirectoryInfo(Path.GetTempPath()));

            Assert.Equal(expected.FullName, actual.FullName);
        }
Example #4
0
        public void op_ToPath_FileSystemInfo_whenTel()
        {
            AbsoluteUri obj = "tel:+441234555666";

            var expected = new DirectoryInfo(Path.Combine(Path.GetTempPath(), @"tel\+441234555666"));
            var actual   = obj.ToPath(new DirectoryInfo(Path.GetTempPath()));

            Assert.Equal(expected.FullName, actual.FullName);
        }
Example #5
0
        public void op_ToPath_FileSystemInfo()
        {
            AbsoluteUri obj = "http://example.com/foo/bar?x=1&y=2#fragment";

            var expected = new DirectoryInfo(Path.Combine(Path.GetTempPath(), @"http\example.com\foo\bar?x=1&y=2#fragment"));
            var actual   = obj.ToPath(new DirectoryInfo(Path.GetTempPath()));

            Assert.Equal(expected.FullName, actual.FullName);
        }
Example #6
0
        public void op_ToPath_FileSystemInfoNull()
        {
            AbsoluteUri obj = "http://example.com/";

            Assert.Throws <ArgumentNullException>(() => obj.ToPath(null));
        }