Converted ChangeLogs to UTF-8 and recovered incorrectly encoded characters.
[mono.git] / mcs / class / System / Test / System / UriCas.cs
1 //
2 // UriCas.cs - CAS unit tests for System.Uri
3 //
4 // Author:
5 //      Sebastien Pouliot  <sebastien@ximian.com>
6 //
7 // Copyright (C) 2005 Novell, Inc (http://www.novell.com)
8 //
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:
16 // 
17 // The above copyright notice and this permission notice shall be
18 // included in all copies or substantial portions of the Software.
19 // 
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.
27 //
28
29 using NUnit.Framework;
30
31 using System;
32 using System.Reflection;
33 using System.Security;
34 using System.Security.Permissions;
35
36 using MonoTests.System;
37
38 namespace MonoCasTests.System {
39
40         [TestFixture]
41         [Category ("CAS")]
42         public class UriCas {
43
44                 [SetUp]
45                 public virtual void SetUp ()
46                 {
47                         if (!SecurityManager.SecurityEnabled)
48                                 Assert.Ignore ("SecurityManager.SecurityEnabled is OFF");
49                 }
50
51                 [Test]
52                 [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
53                 public void UnitTestReuse ()
54                 {
55                         UriTest unit = new UriTest ();
56                         unit.GetReady ();
57
58                         unit.Constructors ();
59                         unit.Constructor_DualHostPort ();
60                         unit.RelativeCtor ();
61                         unit.LeadingSlashes ();
62                         unit.ConstructorsRejectRelativePath ();
63                         unit.LocalPath ();
64                         unit.LocalPath_FileHost ();
65                         unit.LocalPath_Escape ();
66                         unit.UnixPath ();
67                         unit.Unc ();
68                         unit.FromHex ();
69                         unit.Unescape ();
70                         unit.HexEscape ();
71                         unit.HexUnescape ();
72                         unit.IsHexDigit ();
73                         unit.IsHexEncoding ();
74                         unit.GetLeftPart ();
75                         unit.NewsDefaultPort ();
76                         unit.FragmentEscape ();
77                         unit.CheckHostName2 ();
78                         unit.IsLoopback ();
79                         unit.Equals1 ();
80                         unit.TestEquals2 ();
81                         unit.CaseSensitivity ();
82                         unit.GetHashCodeTest ();
83                         unit.MakeRelative ();
84                         unit.RelativeUri ();
85                         unit.ToStringTest ();
86                         unit.CheckSchemeName ();
87                         unit.CheckSchemeName_FirstChar ();
88                         unit.CheckSchemeName_AnyOtherChar ();
89                         unit.Segments1 ();
90                         unit.Segments2 ();
91                         unit.Segments3 ();
92                         unit.Segments5 ();
93                         unit.UnixLocalPath ();
94 #if NET_2_0
95                         unit.PortMax ();
96 #endif
97                 }
98
99                 [Test]
100                 [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
101 #if NET_2_0
102                 [Category ("NotDotNet")] // tests needs to be updated for 2.0
103 #endif
104                 public void UnitTest2Reuse ()
105                 {
106                         UriTest2 unit = new UriTest2 ();
107                         unit.AbsoluteUriFromFile ();
108                         unit.RelativeUriFromFile ();
109                         unit.MoreUnescape ();
110                         unit.UriScheme ();
111                 }
112 #if NET_2_0
113                 [Test]
114                 [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
115                 [Category ("NotWorking")]
116                 public void UnitTest3Reuse ()
117                 {
118                         UriTest3 unit = new UriTest3 ();
119                         unit.Absolute_UriKind_Absolute ();
120                         unit.Relative_UriKind_Relative ();
121                         unit.TryCreate_String_UriKind_Uri ();
122                         unit.TryCreate_Uri_String_Uri ();
123                         unit.TryCreate_Uri_Uri_Uri ();
124                 }
125 #endif
126                 [Test]
127                 [PermissionSet (SecurityAction.Deny, Unrestricted = true)]
128                 public void LinkDemand_Deny_Unrestricted ()
129                 {
130                         Type[] types = new Type[1] { typeof (string) };
131                         ConstructorInfo ci = typeof (Uri).GetConstructor (types);
132                         Assert.IsNotNull (ci, ".ctor(string)");
133                         Assert.IsNotNull (ci.Invoke (new object[1] { "http://www.mono-project.com/" }), "invoke");
134                 }
135         }
136 }