示例#1
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);
        }
示例#2
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);
        }
示例#3
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);
        }
示例#4
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);
        }
示例#5
0
        public void op_GetHashCode()
        {
            var obj = new AbsoluteUri("http://example.com/");

            var expected = obj.ToString().GetHashCode();
            var actual   = obj.GetHashCode();

            Assert.Equal(expected, actual);
        }
示例#6
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);
        }
示例#7
0
        public void op_CompareTo_objectSame()
        {
            var obj = new AbsoluteUri("http://example.com/");

            const int expected = 0;
            var       actual   = obj.CompareTo(obj as object);

            Assert.Equal(expected, actual);
        }
示例#8
0
        public void op_CompareTo_AbsoluteUriEqual()
        {
            var obj       = new AbsoluteUri("http://example.com/");
            var comparand = new AbsoluteUri("http://example.com/");

            const int expected = 0;
            var       actual   = obj.CompareTo(comparand);

            Assert.Equal(expected, actual);
        }
示例#9
0
        public void op_CompareTo_objectLesser()
        {
            var    obj       = new AbsoluteUri("http://example.net/");
            object comparand = new AbsoluteUri("http://example.com/");

            const int expected = 11;
            var       actual   = obj.CompareTo(comparand);

            Assert.Equal(expected, actual);
        }
示例#10
0
        public void ctor_SerializationInfo_StreamingContext()
        {
            var         expected = new AbsoluteUri("http://example.com");
            AbsoluteUri actual;

            using (Stream stream = new MemoryStream())
            {
                var formatter = new BinaryFormatter();
                formatter.Serialize(stream, new AbsoluteUri("http://example.com"));
                stream.Position = 0;
                actual          = (AbsoluteUri)formatter.Deserialize(stream);
            }

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

            Assert.Throws <ArgumentNullException>(() => obj.ToPath(null));
        }
示例#12
0
        public void op_Equals_objectSame()
        {
            var obj = new AbsoluteUri("http://example.com/");

            Assert.True(obj.Equals(obj as object));
        }
示例#13
0
        public void opLesserThan_AbsoluteUri_AbsoluteUriNull()
        {
            var obj = new AbsoluteUri("http://example.com/");

            Assert.False(obj < null);
        }
示例#14
0
        public void opLesserThan_AbsoluteUriNull_AbsoluteUri()
        {
            var comparand = new AbsoluteUri("http://example.com/");

            Assert.True(null < comparand);
        }
示例#15
0
        public void opGreaterThan_AbsoluteUri_AbsoluteUriNull()
        {
            var obj = new AbsoluteUri("http://example.com/");

            Assert.True(obj > null);
        }
示例#16
0
        public void opGreaterThan_AbsoluteUriNull_AbsoluteUri()
        {
            var comparand = new AbsoluteUri("http://example.com/");

            Assert.False(null > comparand);
        }