Exemplo n.º 1
0
        public void TestConvertDirectRelativeWithParamUri()
        {
            string relative = "default.aspx";
            Uri relativeUri = new Uri(relative, UriKind.RelativeOrAbsolute);

            Uri resultUri = new Uri("http://www.SLExtensions.Controls.com/default.aspx");
            UriConverter converter = new UriConverter();

            Uri param = new Uri("http://www.SLExtensions.Controls.com");

            object result = converter.Convert(relative, typeof(Uri), param, CultureInfo.CurrentCulture);
            Assert.IsInstanceOfType(result, typeof(Uri));

            Assert.AreEqual(resultUri.ToString(), ((Uri)result).ToString());

            result = converter.Convert(relativeUri, typeof(Uri), param, CultureInfo.CurrentCulture);
            Assert.IsInstanceOfType(result, typeof(Uri));

            Assert.AreEqual(resultUri.ToString(), ((Uri)result).ToString());
        }
Exemplo n.º 2
0
        public void TestConvertDirectAbsolute()
        {
            string absolute = "http://www.SLExtensions.Controls.com";
            Uri absoluteUri = new Uri(absolute);
            UriConverter converter = new UriConverter();

            object result = converter.Convert(absolute, typeof(Uri), null, CultureInfo.CurrentCulture);
            Assert.IsInstanceOfType(result, typeof(Uri));

            Assert.AreEqual(absoluteUri.ToString(), ((Uri)result).ToString());

            result = converter.Convert(absoluteUri, typeof(Uri), null, CultureInfo.CurrentCulture);
            Assert.IsInstanceOfType(result, typeof(Uri));

            Assert.AreEqual(absoluteUri.ToString(), ((Uri)result).ToString());
        }
Exemplo n.º 3
0
        public void TestConvertDirectRelative()
        {
            string relative = "default.aspx";
            Uri relativeUri = new Uri(relative, UriKind.RelativeOrAbsolute);
            UriConverter converter = new UriConverter();

            object result = converter.Convert(relative, typeof(Uri), null, CultureInfo.CurrentCulture);
            Assert.IsInstanceOfType(result, typeof(Uri));

            Assert.AreEqual(relativeUri.ToString(), ((Uri)result).ToString());

            result = converter.Convert(relativeUri, typeof(Uri), null, CultureInfo.CurrentCulture);
            Assert.IsInstanceOfType(result, typeof(Uri));

            Assert.AreEqual(relativeUri.ToString(), ((Uri)result).ToString());
        }