Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -62,9 +62,6 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if !NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void ApplicationDirectory_Invalid ()
{
new ApplicationDirectory (Invalid (false));
@@ -74,11 +71,7 @@ namespace MonoTests.System.Security.Policy {
public void ApplicationDirectory_String ()
{
ApplicationDirectory ad = new ApplicationDirectory ("mono");
#if NET_2_0
Assert.AreEqual ("mono", ad.Directory, "Directory");
#else
Assert.AreEqual ("file://MONO", ad.Directory, "Directory");
#endif
}
[Test]
@@ -99,11 +92,7 @@ namespace MonoTests.System.Security.Policy {
public void Copy ()
{
ApplicationDirectory ad = new ApplicationDirectory ("novell");
#if NET_2_0
Assert.AreEqual ("novell", ad.Directory, "Directory");
#else
Assert.AreEqual ("file://NOVELL", ad.Directory, "Directory");
#endif
ApplicationDirectory copy = (ApplicationDirectory)ad.Copy ();
Assert.IsTrue (ad.Equals (copy), "ad.Equals(copy)");
Assert.IsTrue (copy.Equals (ad), "copy.Equals(ad)");
@@ -132,23 +121,13 @@ namespace MonoTests.System.Security.Policy {
{
string linux = "/unix/path/mono";
ApplicationDirectory ad1 = new ApplicationDirectory (linux);
#if NET_2_0
Assert.AreEqual (linux, ad1.Directory);
Assert.AreEqual (linux.GetHashCode (), ad1.GetHashCode (), "GetHashCode-Linux");
#else
Assert.AreEqual ("file://UNIX/PATH/mono", ad1.Directory);
Assert.AreEqual ("file://UNIX/PATH/mono".GetHashCode (), ad1.GetHashCode (), "GetHashCode-Linux");
#endif
string windows = "\\windows\\path\\mono";
ApplicationDirectory ad2 = new ApplicationDirectory (windows);
#if NET_2_0
Assert.AreEqual (windows, ad2.Directory);
Assert.AreEqual (windows.GetHashCode (), ad2.GetHashCode (), "GetHashCode-Windows");
#else
Assert.AreEqual ("file://WINDOWS/PATH/mono", ad2.Directory);
Assert.AreEqual ("file://WINDOWS/PATH/mono".GetHashCode (), ad2.GetHashCode (), "GetHashCode-Windows");
#endif
}
[Test]
@@ -161,7 +140,6 @@ namespace MonoTests.System.Security.Policy {
Assert.IsTrue (ts.IndexOf ("<Directory>file://MONO</Directory>") > 0, "Directory");
}
#if NET_2_0
[Test]
[ExpectedException (typeof (ArgumentException))]
public void Equals_Invalid ()
@@ -186,6 +164,5 @@ namespace MonoTests.System.Security.Policy {
{
new ApplicationDirectory (Invalid (true)).ToString ();
}
#endif
}
}

View File

@@ -27,7 +27,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using NUnit.Framework;
@@ -159,4 +158,3 @@ namespace MonoCasTests.System.Security.Policy {
}
}
#endif

View File

@@ -27,7 +27,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using NUnit.Framework;
using System;
@@ -169,4 +168,3 @@ namespace MonoTests.System.Security.Policy {
}
}
#endif

View File

@@ -26,7 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using NUnit.Framework;
@@ -255,4 +254,3 @@ namespace MonoTests.System.Security.Policy {
}
}
#endif

View File

@@ -26,7 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using NUnit.Framework;
using System;
@@ -201,4 +200,3 @@ namespace MonoTests.System.Security.Policy {
}
}
#endif

View File

@@ -26,7 +26,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
#if NET_2_0
using NUnit.Framework;
using System;
@@ -92,4 +91,3 @@ namespace MonoTests.System.Security.Policy {
}
}
#endif

View File

@@ -109,9 +109,6 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if !NET_2_0
[Category ("NotDotNet")] // Current hashing is compatible with Fx 2.0 but not with Fx 1.0/1.1
#endif
public void MD5_Property ()
{
Hash h = new Hash (wellKnownAssembly);
@@ -119,9 +116,6 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if !NET_2_0
[Category ("NotDotNet")] // Current hashing is compatible with Fx 2.0 but not with Fx 1.0/1.1
#endif
public void SHA1_Property ()
{
Hash h = new Hash (wellKnownAssembly);
@@ -129,9 +123,6 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if !NET_2_0
[Category ("NotDotNet")] // Current hashing is compatible with Fx 2.0 but not with Fx 1.0/1.1
#endif
public void GenerateHash_MD5 ()
{
Hash h = new Hash (wellKnownAssembly);
@@ -140,9 +131,6 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if !NET_2_0
[Category ("NotDotNet")] // Current hashing is compatible with Fx 2.0 but not with Fx 1.0/1.1
#endif
public void GenerateHash_SHA1 ()
{
Hash h = new Hash (wellKnownAssembly);
@@ -151,9 +139,6 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if !NET_2_0
[Category ("NotDotNet")] // Current hashing is compatible with Fx 2.0 but not with Fx 1.0/1.1
#endif
public void GenerateHash_SHA256 ()
{
Hash h = new Hash (wellKnownAssembly);
@@ -162,9 +147,6 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if !NET_2_0
[Category ("NotDotNet")] // Current hashing is compatible with Fx 2.0 but not with Fx 1.0/1.1
#endif
public void GenerateHash_SHA384 ()
{
Hash h = new Hash (wellKnownAssembly);
@@ -173,9 +155,6 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if !NET_2_0
[Category ("NotDotNet")] // Current hashing is compatible with Fx 2.0 but not with Fx 1.0/1.1
#endif
public void GenerateHash_SHA512 ()
{
Hash h = new Hash (wellKnownAssembly);
@@ -183,7 +162,6 @@ namespace MonoTests.System.Security.Policy {
Assert.AreEqual ("C0-05-76-29-F9-E7-32-A9-8D-73-4B-90-12-6A-85-3F-5C-D3-5B-EF-A6-F2-A6-15-38-9C-22-FA-7E-72-CA-10-B0-21-E0-B6-0B-B8-AB-9E-0E-9F-64-0E-C6-F3-48-96-01-7B-A6-20-07-2F-03-6A-51-03-0F-3F-C4-70-B3-0F", BitConverter.ToString (result));
}
#if NET_2_0
[Test]
public void GenerateHash_RIPEMD160 ()
{
@@ -251,6 +229,5 @@ namespace MonoTests.System.Security.Policy {
Hash h = Hash.CreateSHA1 (new byte [0]);
string ts = h.ToString ();
}
#endif
}
}

View File

@@ -101,7 +101,6 @@ namespace MonoTests.System.Security.Policy {
Assert.AreEqual (21, GetRequiredSize (ad, true), "GetRequiredSize-true-2");
Assert.AreEqual (19, GetRequiredSize (ad, false), "GetRequiredSize-false-2");
}
#if NET_2_0
[Test]
public void GacInstalled_GetRequiredSize ()
{
@@ -169,7 +168,6 @@ namespace MonoTests.System.Security.Policy {
GacInstalled g = new GacInstalled ();
OutputToBuffer (g, buffer, 1, false);
}
#endif
[Test]
public void Hash_GetRequiredSize ()
{

View File

@@ -54,13 +54,8 @@ namespace MonoTests.System.Security.Policy {
Assert.IsNull (cg.PolicyStatement, "PolicyStatement");
// documented as always null
Assert.IsNull (cg.AttributeString, "AttributeString");
#if NET_2_0
// seems it's easier to change code than to change code ;)
Assert.AreEqual ("Same site Web", cg.PermissionSetName, "PermissionSetName");
#else
// documented as always "Same site Web" but it's "Same site Web." (missing .)
Assert.AreEqual ("Same site Web.", cg.PermissionSetName, "PermissionSetName");
#endif
}
[Test]

View File

@@ -42,11 +42,9 @@ namespace MonoTests.System.Security.Policy {
private string AdjustNewLine (string s)
{
#if NET_2_0
// no spaces are used in Fx 2.0
while (s.IndexOf ("\r\n ") != -1)
s = s.Replace ("\r\n ", "\r\n");
#endif
if (Environment.NewLine != "\r\n")
s = s.Replace ("\r\n", Environment.NewLine);
return s;

View File

@@ -124,9 +124,6 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if ! NET_2_0
[Category ("NotDotNet")] // System.ExecutionEngineException on MS runtime (1.1)
#endif
public void AddNamedPermissionSet ()
{
PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
@@ -148,9 +145,6 @@ namespace MonoTests.System.Security.Policy {
[Test]
[ExpectedException (typeof (ArgumentException))]
#if ! NET_2_0
[Category ("NotDotNet")] // System.ExecutionEngineException on MS runtime (1.1)
#endif
public void AddNamedPermissionSet_Duplicate ()
{
PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
@@ -162,9 +156,6 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if ! NET_2_0
[Category ("NotDotNet")] // System.ExecutionEngineException on MS runtime (1.1)
#endif
public void ChangeNamedPermissionSet ()
{
PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
@@ -319,9 +310,6 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if ! NET_2_0
[Category ("NotDotNet")] // System.ExecutionEngineException on MS runtime (1.1)
#endif
public void GetNamedPermissionSet ()
{
PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
@@ -449,9 +437,6 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if ! NET_2_0
[Category ("NotDotNet")] // System.ExecutionEngineException on MS runtime (1.1)
#endif
public void RemoveNamedPermissionSet ()
{
PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);
@@ -481,9 +466,6 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if ! NET_2_0
[Category ("NotDotNet")] // System.ExecutionEngineException on MS runtime (1.1)
#endif
public void RemoveNamedPermissionSet_String ()
{
PolicyLevel pl = Load (minimal, PolicyLevelType.Machine);

View File

@@ -189,7 +189,6 @@ namespace MonoTests.System.Security.Policy {
Assert.AreEqual (ps1.ToXml ().ToString (), ps2.ToXml ().ToString (), "Xml");
}
#if NET_2_0
[Test]
[Category ("NotWorking")]
public void Equals ()
@@ -212,6 +211,5 @@ namespace MonoTests.System.Security.Policy {
Assert.IsTrue (unr3.Equals (unr2), "unr3.Equals (unr2)");
Assert.IsTrue (unr2.Equals (unr3), "unr2.Equals (unr3)");
}
#endif
}
}

View File

@@ -56,9 +56,7 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void EmptyCertificateConstructor ()
{
byte[] n = null;
@@ -70,11 +68,7 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#else
[ExpectedException (typeof (NullReferenceException))]
#endif
public void EmptyCertificateConstructor2 ()
{
byte[] n = null;
@@ -95,9 +89,6 @@ namespace MonoTests.System.Security.Policy {
Assert.IsTrue ((ip is PublisherIdentityPermission), "CreateIdentityPermission");
string s = "<System.Security.Policy.Publisher version=\"1\">" + Environment.NewLine;
#if !NET_2_0
s += " ";
#endif
s += "<X509v3Certificate>3082050F308203F7A003020102020A61071143000000000034300D06092A864886F70D01010505003081A6310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F70797269676874202863292032303030204D6963726F736F667420436F72702E312330210603550403131A4D6963726F736F667420436F6465205369676E696E6720504341301E170D3032303532353030353534385A170D3033313132353031303534385A3081A1310B3009060355040613025553311330110603550408130A57617368696E67746F6E3110300E060355040713075265646D6F6E64311E301C060355040A13154D6963726F736F667420436F72706F726174696F6E312B3029060355040B1322436F70797269676874202863292032303032204D6963726F736F667420436F72702E311E301C060355040313154D6963726F736F667420436F72706F726174696F6E30820122300D06092A864886F70D01010105000382010F003082010A0282010100AA99BD39A81827F42B3D0B4C3F";
s += "7C772EA7CBB5D18C0DC23A74D793B5E0A04B3F595ECE454F9A7929F149CC1A47EE55C2083E1220F855F2EE5FD3E0CA96BC30DEFE58C82732D08554E8F09110BBF32BBE19E5039B0B861DF3B0398CB8FD0B1D3C7326AC572BCA29A215908215E277A34052038B9DC270BA1FE934F6F335924E5583F8DA30B620DE5706B55A4206DE59CBF2DFA6BD154771192523D2CB6F9B1979DF6A5BF176057929FCC356CA8F440885558ACBC80F464B55CB8C96774A87E8A94106C7FF0DE968576372C36957B443CF323A30DC1BE9D543262A79FE95DB226724C92FD034E3E6FB514986B83CD0255FD6EC9E036187A96840C7F8E203E6CF050203010001A38201403082013C300E0603551D0F0101FF0404030206C030130603551D25040C300A06082B06010505070303301D0603551D0E041604146BC8C65120F0B42FD3A0B6AE7F5E26B2B88752293081A90603551D230481A130819E8014295CB91BB6CD33EEBB9E597DF7E5CA2EC40D3428A174A4723070312B3029060355040B1322436F70797269676874202863292031393937204D6963726F736F667420436F72702E311E301C060355040B13154D6963726F736F667420436F72706F726174696F6E3121301F060355040313184D6963726F736F667420526F6F7420417574686F7269747982106A0B994FC000DEAA11D4D8";
s += "409AA8BEE6304A0603551D1F04433041303FA03DA03B8639687474703A2F2F63726C2E6D6963726F736F66742E636F6D2F706B692F63726C2F70726F64756374732F436F64655369676E5043412E63726C300D06092A864886F70D010105050003820101003523FD1354FCE9DCF0DD0C147AFAA7B3CEFDA73AC8BAE5E7F603FB53DBA799A9A09B369C03EB82471C21BD14CBE7674009C716910255CE4342B4CD1B5DB0F332043D12E51DA707A78FA37E4555761B96959169F0DD38F34889EF7040B7DBB55580C003C42EB628DC0A820EC743E37A485DB8068992406C6EC5DCF89AEF0BBE210A8C2F3AB5EDA7CE71876823E1B3E4187DB84701A52BC458CBB2896C5FFDD32CC46FB823B20DFF3CF2114574F209069918DD6FC0860118121D2B16AF56EF6533A1EA674EF44B82ABE90FDC01FADF607F66475DCB2C70CC7B4ED906B86E8C0CFE621E42F9937CA2AB0A9ED02310AE4D7B27916F26BE68FAA63F9F23EBC89DBB87</X509v3Certificate>" + Environment.NewLine + "</System.Security.Policy.Publisher>" + Environment.NewLine;

View File

@@ -79,11 +79,7 @@ namespace MonoTests.System.Security.Policy {
{
Site s = new Site ("www.go-mono.com");
Assert.AreEqual ("www.go-mono.com", s.Name, "Name");
#if NET_2_0
Assert.AreEqual ("<System.Security.Policy.Site version=\"1\">" + Environment.NewLine + "<Name>www.go-mono.com</Name>" + Environment.NewLine + "</System.Security.Policy.Site>" + Environment.NewLine, s.ToString (), "ToString");
#else
Assert.AreEqual ("<System.Security.Policy.Site version=\"1\">" + Environment.NewLine + " <Name>www.go-mono.com</Name>" + Environment.NewLine + "</System.Security.Policy.Site>" + Environment.NewLine, s.ToString (), "ToString");
#endif
Site s2 = (Site) s.Copy ();
Assert.AreEqual (s.Name, s2.Name, "Copy.Name");
Assert.AreEqual (s.GetHashCode (), s2.GetHashCode (), "Copy.GetHashCode");
@@ -101,11 +97,7 @@ namespace MonoTests.System.Security.Policy {
{
Site s = new Site ("*.go-mono.com");
Assert.AreEqual ("*.go-mono.com", s.Name, "Name");
#if NET_2_0
Assert.AreEqual ("<System.Security.Policy.Site version=\"1\">" + Environment.NewLine + "<Name>*.go-mono.com</Name>" + Environment.NewLine + "</System.Security.Policy.Site>" + Environment.NewLine, s.ToString (), "ToString");
#else
Assert.AreEqual ("<System.Security.Policy.Site version=\"1\">" + Environment.NewLine + " <Name>*.go-mono.com</Name>" + Environment.NewLine + "</System.Security.Policy.Site>" + Environment.NewLine, s.ToString (), "ToString");
#endif
Site s2 = (Site) s.Copy ();
Assert.AreEqual (s.Name, s2.Name, "Copy.Name");
Assert.AreEqual (s.GetHashCode (), s2.GetHashCode (), "Copy.GetHashCode");
@@ -160,11 +152,7 @@ namespace MonoTests.System.Security.Policy {
{
Site s = new Site ("*");
Assert.AreEqual ("*", s.Name, "Name");
#if NET_2_0
Assert.AreEqual ("<System.Security.Policy.Site version=\"1\">" + Environment.NewLine + "<Name>*</Name>" + Environment.NewLine + "</System.Security.Policy.Site>" + Environment.NewLine, s.ToString (), "ToString");
#else
Assert.AreEqual ("<System.Security.Policy.Site version=\"1\">" + Environment.NewLine + " <Name>*</Name>" + Environment.NewLine + "</System.Security.Policy.Site>" + Environment.NewLine, s.ToString (), "ToString");
#endif
Site s2 = (Site) s.Copy ();
Assert.AreEqual (s.Name, s2.Name, "Copy.Name");
Assert.AreEqual (s.GetHashCode (), s2.GetHashCode (), "Copy.GetHashCode");
@@ -192,19 +180,12 @@ namespace MonoTests.System.Security.Policy {
// Console.WriteLine ("FAIL: {0} - {1}", i, c);
}
bool result = ((i == 45) // -
#if NET_2_0
|| (i == 33) // !
|| (i >= 35 && i <= 42) // #$%&'()*
|| (i >= 48 && i <= 57) // 0-9
|| (i >= 94 && i <= 95) // ^_
|| (i >= 97 && i <= 123) // a-z{
|| (i >= 125 && i <= 126) // }~
#else
|| (i == 42) // *
|| (i >= 47 && i <= 57) // /,0-9
|| (i == 95) // _
|| (i >= 97 && i <= 122) // a-z
#endif
|| (i >= 64 && i <= 90)); // @,A-Z
Assert.IsTrue ((actual == result), "#"+i);
}
@@ -228,9 +209,6 @@ namespace MonoTests.System.Security.Policy {
"http://www.go-mono.com",
"http://*.go-mono.com",
"http://www.go-mono.com:8080/index.html",
#if !NET_2_0
"file://mono/index.html", // file:// is supported as a site (1.0/1.1)
#endif
};
[Test]
@@ -242,7 +220,6 @@ namespace MonoTests.System.Security.Policy {
}
}
#if NET_2_0
string[] invalid_urls = {
"file://mono/index.html", // file:// isn't supported as a site (2.0)
};
@@ -269,6 +246,5 @@ namespace MonoTests.System.Security.Policy {
}
}
}
#endif
}
}

View File

@@ -68,9 +68,7 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void EmptyNameConstructor ()
{
StrongName sn = new StrongName (snpkb, String.Empty, version);
@@ -100,11 +98,7 @@ namespace MonoTests.System.Security.Policy {
string s = String.Format ("<StrongName version=\"1\"{0}{1}Key=\"00240000048000009400000006020000002400005253413100040000010001003DBD7208C62B0EA8C1C058072B635F7C9ABDCB22DB20B2A9DADAEFE800642F5D8DEB7802F7A5367728D7558D1468DBEB2409D02B131B926E2E59544AAC18CFC909023F4FA83E94001FC2F11A27477D1084F514B861621A0C66ABD24C4B9FC90F3CD8920FF5FFCED76E5C6FB1F57DD356F96727A4A5485B079344004AF8FFA4CB\"{0}{1}Name=\"StrongNameName\"{0}{1}Version=\"1.2.3.4\"/>{0}",
Environment.NewLine,
#if NET_2_0
String.Empty);
#else
" ");
#endif
Assert.AreEqual (s, sn.ToString (), "ToString");
}

View File

@@ -118,66 +118,35 @@ namespace MonoTests.System.Security.Policy {
public void Url_NoProtocol ()
{
UrlMembershipCondition umc = new UrlMembershipCondition ("www.go-mono.com");
#if NET_2_0
Assert.AreEqual ("www.go-mono.com", umc.Url, "Url");
Assert.AreEqual ("Url - www.go-mono.com", umc.ToString (), "ToString");
#else
// note: no last slash here
Assert.AreEqual ("file://WWW.GO-MONO.COM", umc.Url, "Url");
Assert.AreEqual ("Url - file://WWW.GO-MONO.COM", umc.ToString (), "ToString");
#endif
}
[Test]
public void Url_WellKnownProtocol ()
{
UrlMembershipCondition umc = new UrlMembershipCondition ("http://www.go-mono.com");
#if NET_2_0
Assert.AreEqual ("http://www.go-mono.com", umc.Url, "http-Url");
Assert.AreEqual ("Url - http://www.go-mono.com", umc.ToString (), "http-ToString");
#else
Assert.AreEqual ("http://www.go-mono.com/", umc.Url, "http-Url");
Assert.AreEqual ("Url - http://www.go-mono.com/", umc.ToString (), "http-ToString");
#endif
umc = new UrlMembershipCondition ("https://www.go-mono.com");
#if NET_2_0
Assert.AreEqual ("https://www.go-mono.com", umc.Url, "https-Url");
Assert.AreEqual ("Url - https://www.go-mono.com", umc.ToString (), "https-ToString");
#else
Assert.AreEqual ("https://www.go-mono.com/", umc.Url, "https-Url");
Assert.AreEqual ("Url - https://www.go-mono.com/", umc.ToString (), "https-ToString");
#endif
umc = new UrlMembershipCondition ("ftp://www.go-mono.com");
#if NET_2_0
Assert.AreEqual ("ftp://www.go-mono.com", umc.Url, "ftp-Url");
Assert.AreEqual ("Url - ftp://www.go-mono.com", umc.ToString (), "ftp-ToString");
#else
Assert.AreEqual ("ftp://www.go-mono.com/", umc.Url, "ftp-Url");
Assert.AreEqual ("Url - ftp://www.go-mono.com/", umc.ToString (), "ftp-ToString");
#endif
umc = new UrlMembershipCondition ("file://www.go-mono.com");
#if NET_2_0
Assert.AreEqual ("file://www.go-mono.com", umc.Url, "file-Url");
Assert.AreEqual ("Url - file://www.go-mono.com", umc.ToString (), "file-ToString");
#else
Assert.AreEqual ("file://WWW.GO-MONO.COM", umc.Url, "file-Url");
Assert.AreEqual ("Url - file://WWW.GO-MONO.COM", umc.ToString (), "file-ToString");
#endif
}
[Test]
public void Url_UnknownProtocol ()
{
UrlMembershipCondition umc = new UrlMembershipCondition ("mono://www.go-mono.com");
#if NET_2_0
Assert.AreEqual ("mono://www.go-mono.com", umc.Url, "Url");
Assert.AreEqual ("Url - mono://www.go-mono.com", umc.ToString (), "ToString");
#else
Assert.AreEqual ("mono://www.go-mono.com/", umc.Url, "Url");
Assert.AreEqual ("Url - mono://www.go-mono.com/", umc.ToString (), "ToString");
#endif
}
[Test]

View File

@@ -56,11 +56,7 @@ namespace MonoTests.System.Security.Policy {
public void Url_NoProtocol ()
{
Url u = new Url ("index.html");
#if NET_2_0
Assert.AreEqual ("index.html", u.Value, "Value");
#else
Assert.AreEqual ("file://INDEX.HTML", u.Value, "Value");
#endif
}
[Test]
@@ -70,17 +66,10 @@ namespace MonoTests.System.Security.Policy {
Url u2 = new Url ("ftp://www.go-mono.com");
Url u3 = new Url ("http://www.go-mono.com");
Url u4 = new Url ("https://www.go-mono.com");
#if NET_2_0
Assert.AreEqual ("file://mono/index.html", u1.Value, "file.Value");
Assert.AreEqual ("ftp://www.go-mono.com", u2.Value, "ftp.Value");
Assert.AreEqual ("http://www.go-mono.com", u3.Value, "http.Value");
Assert.AreEqual ("https://www.go-mono.com", u4.Value, "https.Value");
#else
Assert.AreEqual ("file://MONO/INDEX.HTML", u1.Value, "file.Value");
Assert.AreEqual ("ftp://www.go-mono.com/", u2.Value, "ftp.Value");
Assert.AreEqual ("http://www.go-mono.com/", u3.Value, "http.Value");
Assert.AreEqual ("https://www.go-mono.com/", u4.Value, "https.Value");
#endif
}
[Test]
@@ -106,12 +95,8 @@ namespace MonoTests.System.Security.Policy {
Url u = new Url (url);
Assert.IsTrue (u.Value.StartsWith (url), "Value");
#if NET_2_0
// no spaces in XML, no ending '/' on url
Assert.AreEqual ("<System.Security.Policy.Url version=\"1\">" + Environment.NewLine + "<Url>http://www.go-mono.com</Url>" + Environment.NewLine + "</System.Security.Policy.Url>" + Environment.NewLine, u.ToString (), "ToString");
#else
Assert.AreEqual ("<System.Security.Policy.Url version=\"1\">" + Environment.NewLine + " <Url>http://www.go-mono.com/</Url>" + Environment.NewLine + "</System.Security.Policy.Url>" + Environment.NewLine, u.ToString (), "ToString");
#endif
Url u2 = (Url) u.Copy ();
Assert.AreEqual (u.Value, u2.Value, "Copy.Value");
Assert.AreEqual (u.GetHashCode (), u2.GetHashCode (), "Copy.GetHashCode");
@@ -125,15 +110,10 @@ namespace MonoTests.System.Security.Policy {
}
[Test]
#if !NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void Url_InvalidSite ()
{
Url u = new Url ("http://www.go-mono.*");
#if NET_2_0
Assert.AreEqual ("http://www.go-mono.*", u.Value, "Value");
#endif
}
[Test]
@@ -164,13 +144,8 @@ namespace MonoTests.System.Security.Policy {
public void Url_LoneStar ()
{
Url u = new Url ("*");
#if NET_2_0
Assert.AreEqual ("*", u.Value, "Value");
Assert.AreEqual ("<System.Security.Policy.Url version=\"1\">" + Environment.NewLine + "<Url>*</Url>" + Environment.NewLine + "</System.Security.Policy.Url>" + Environment.NewLine, u.ToString (), "ToString");
#else
Assert.AreEqual ("file://*", u.Value, "Value");
Assert.AreEqual ("<System.Security.Policy.Url version=\"1\">" + Environment.NewLine + " <Url>file://*</Url>" + Environment.NewLine + "</System.Security.Policy.Url>" + Environment.NewLine, u.ToString (), "ToString");
#endif
Url u2 = (Url) u.Copy ();
Assert.AreEqual (u.Value, u2.Value, "Copy.Value");
Assert.AreEqual (u.GetHashCode (), u2.GetHashCode (), "Copy.GetHashCode");

View File

@@ -114,9 +114,7 @@ namespace MonoTests.System.Security.Policy {
Assert.IsTrue (zmc.ToString ().StartsWith ("Zone - "), "ToString-1");
Assert.IsTrue (zmc.ToString ().EndsWith (zmc.SecurityZone.ToString ()), "ToString-2");
#if NET_2_0
Assert.AreEqual (zmc.SecurityZone.GetHashCode (), zmc.GetHashCode (), "GetHashCode");
#endif
return zmc; // for further tests
}