2 // UriCas.cs - CAS unit tests for System.Uri
5 // Sebastien Pouliot <sebastien@ximian.com>
7 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
9 // Permission is hereby granted, free of charge, to any person obtaining
10 // a copy of this software and associated documentation files (the
11 // "Software"), to deal in the Software without restriction, including
12 // without limitation the rights to use, copy, modify, merge, publish,
13 // distribute, sublicense, and/or sell copies of the Software, and to
14 // permit persons to whom the Software is furnished to do so, subject to
15 // the following conditions:
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
23 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
24 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
25 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
26 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 using NUnit.Framework;
32 using System.Reflection;
33 using System.Security;
34 using System.Security.Permissions;
36 using MonoTests.System;
38 namespace MonoCasTests.System {
45 public virtual void SetUp ()
47 if (!SecurityManager.SecurityEnabled)
48 Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
52 [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
53 public void UnitTestReuse ()
55 UriTest unit = new UriTest ();
59 unit.Constructor_DualHostPort ();
61 unit.LeadingSlashes ();
62 unit.ConstructorsRejectRelativePath ();
64 unit.LocalPath_FileHost ();
65 unit.LocalPath_Escape ();
73 unit.IsHexEncoding ();
75 unit.NewsDefaultPort ();
76 unit.FragmentEscape ();
77 unit.CheckHostName2 ();
81 unit.CaseSensitivity ();
82 unit.GetHashCodeTest ();
86 unit.CheckSchemeName ();
87 unit.CheckSchemeName_FirstChar ();
88 unit.CheckSchemeName_AnyOtherChar ();
93 unit.UnixLocalPath ();
98 [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
99 [Category ("NotDotNet")] // tests needs to be updated for 2.0
100 public void UnitTest2Reuse ()
102 UriTest2 unit = new UriTest2 ();
103 unit.AbsoluteUriFromFile ();
104 unit.RelativeUriFromFile ();
105 unit.MoreUnescape ();
109 [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
110 [Category ("NotWorking")]
111 public void UnitTest3Reuse ()
113 UriTest3 unit = new UriTest3 ();
114 unit.Absolute_UriKind_Absolute ();
115 unit.Relative_UriKind_Relative ();
116 unit.TryCreate_String_UriKind_Uri ();
117 unit.TryCreate_Uri_String_Uri ();
118 unit.TryCreate_Uri_Uri_Uri ();
121 [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
122 public void LinkDemand_Deny_Unrestricted ()
124 Type[] types = new Type[1] { typeof (string) };
125 ConstructorInfo ci = typeof (Uri).GetConstructor (types);
126 Assert.IsNotNull (ci, ".ctor(string)");
127 Assert.IsNotNull (ci.Invoke (new object[1] { "http://www.mono-project.com/" }), "invoke");