2 // System.Xml.XmlUrlResolver.cs
\r
5 // Atsushi Enomoto (ginga@kit.hi-ho.ne.jp)
\r
7 // (C) 2003 Atsushi Enomoto
\r
12 using NUnit.Framework;
\r
14 namespace MonoTests.System.Xml
\r
17 public class XmlUrlResolverTests : Assertion
\r
19 XmlUrlResolver resolver;
\r
22 public void GetReady ()
\r
24 resolver = new XmlUrlResolver ();
\r
28 public void FileUri ()
\r
30 Uri resolved = resolver.ResolveUri (null, "Test/XmlFiles/xsd/xml.xsd");
\r
31 AssertEquals ("file", resolved.Scheme);
\r
32 Stream s = resolver.GetEntity (resolved, null, typeof (Stream)) as Stream;
\r
36 public void FileUri2 ()
\r
38 AssertEquals ("file://usr/local/src", resolver.ResolveUri (new Uri ("file://usr/local/src"), null).ToString ());
\r
39 AssertEquals ("file://usr/local/src", resolver.ResolveUri (new Uri ("file:///usr/local/src"), null).ToString ());
\r
43 public void HttpUri ()
\r
45 AssertEquals ("http://test.xml/", resolver.ResolveUri (null, "http://test.xml").ToString ());
\r
49 public void HttpUri2 ()
\r
51 AssertEquals ("http://go-mono.com/", resolver.ResolveUri (new Uri ("http://go-mono.com"), null).ToString ());
\r
55 [ExpectedException (typeof (NullReferenceException))]
\r
56 public void ResolveUriWithNullArgs ()
\r
58 resolver.ResolveUri (null, null);
\r
59 Fail ("Should be error (MS.NET throws ArgumentException here).");
\r
62 // [Test] Uncomment if you want to test.
\r
63 public void GetEntityWithNullArgs ()
\r
65 Uri uri = new Uri ("http://www.go-mono.com/index.rss");
\r
66 resolver.GetEntity (uri, null, null);
\r
70 [ExpectedException (typeof (ArgumentException))]
\r
71 public void GetEntityWithRelativeFileUri ()
\r
73 resolver.GetEntity (new Uri ("file://file.txt"), null, typeof (Stream));
\r
77 [ExpectedException (typeof (XmlException))]
\r
78 public void GetEntityWithNonStreamReturnType ()
\r
80 resolver.GetEntity (new Uri ("http://www.go-mono.com/"), null, typeof (File));
\r