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

@@ -53,13 +53,8 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsFalse (a.Unrestricted, "Unrestricted");
EnvironmentPermission p = (EnvironmentPermission) a.CreatePermission ();
#if NET_2_0
Assert.AreEqual (String.Empty, p.GetPathList (EnvironmentPermissionAccess.Read), "GetPathList(Read)");
Assert.AreEqual (String.Empty, p.GetPathList (EnvironmentPermissionAccess.Write), "GetPathList(Write)");
#else
Assert.IsNull (p.GetPathList (EnvironmentPermissionAccess.Read), "GetPathList(Read)");
Assert.IsNull (p.GetPathList (EnvironmentPermissionAccess.Write), "GetPathList(Write)");
#endif
Assert.IsFalse (p.IsUnrestricted (), "CreatePermission-IsUnrestricted");
}
@@ -121,11 +116,7 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsNull (attr.Write, "Write=null");
EnvironmentPermission p = (EnvironmentPermission) attr.CreatePermission ();
Assert.AreEqual (envar, p.GetPathList (EnvironmentPermissionAccess.Read), "Read=EnvironmentPermission-Read");
#if NET_2_0
Assert.AreEqual (String.Empty, p.GetPathList (EnvironmentPermissionAccess.Write), "Read=EnvironmentPermission-Write");
#else
Assert.IsNull (p.GetPathList (EnvironmentPermissionAccess.Write), "Read=EnvironmentPermission-Write");
#endif
}
[Test]
@@ -136,11 +127,7 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsNull (attr.Read, "Read=null");
Assert.AreEqual (envar, attr.Write, "Write=Write");
EnvironmentPermission p = (EnvironmentPermission) attr.CreatePermission ();
#if NET_2_0
Assert.AreEqual (String.Empty, p.GetPathList (EnvironmentPermissionAccess.Read), "Write=EnvironmentPermission-Read");
#else
Assert.IsNull (p.GetPathList (EnvironmentPermissionAccess.Read), "Write=EnvironmentPermission-Read");
#endif
Assert.AreEqual (envar, p.GetPathList (EnvironmentPermissionAccess.Write), "Write=EnvironmentPermission-Write");
}

View File

@@ -142,13 +142,8 @@ namespace MonoTests.System.Security.Permissions {
public void GetPathList ()
{
EnvironmentPermission ep = new EnvironmentPermission (PermissionState.None);
#if NET_2_0
Assert.AreEqual (String.Empty, ep.GetPathList (EnvironmentPermissionAccess.Read), "GetPathList-Read-Empty");
Assert.AreEqual (String.Empty, ep.GetPathList (EnvironmentPermissionAccess.Write), "GetPathList-Write-Empty");
#else
Assert.IsNull (ep.GetPathList (EnvironmentPermissionAccess.Read), "GetPathList-Read-Empty");
Assert.IsNull (ep.GetPathList (EnvironmentPermissionAccess.Write), "GetPathList-Write-Empty");
#endif
ep.AddPathList (EnvironmentPermissionAccess.Read, "UID");
ep.AddPathList (EnvironmentPermissionAccess.Write, "PROMPT");
Assert.AreEqual ("UID", ep.GetPathList (EnvironmentPermissionAccess.Read), "GetPathList-Read");
@@ -203,9 +198,7 @@ namespace MonoTests.System.Security.Permissions {
ep.FromXml (se2);
}
#if NET_2_0
[Category ("NotWorking")]
#endif
[Test]
public void FromXml ()
@@ -242,9 +235,7 @@ namespace MonoTests.System.Security.Permissions {
ep3 = (EnvironmentPermission) ep2.Union (ep1);
Assert.IsTrue (ep3.IsUnrestricted (), "EP2 U Unrestricted == Unrestricted");
}
#if NET_2_0
[Category ("NotWorking")]
#endif
[Test]
public void Union ()
{

View File

@@ -52,12 +52,10 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsNull (a.PathDiscovery, "PathDiscovery");
Assert.IsNull (a.Read, "Read");
Assert.IsNull (a.Write, "Write");
#if NET_2_0
Assert.IsNotNull (a.AllFiles, "AllFiles");
Assert.IsNotNull (a.AllLocalFiles, "AllLocalFiles");
Assert.IsNull (a.ChangeAccessControl, "ChangeAccessControl");
Assert.IsNull (a.ViewAccessControl, "ViewAccessControl");
#endif
Assert.AreEqual (a.ToString (), a.TypeId.ToString (), "TypeId");
Assert.IsFalse (a.Unrestricted, "Unrestricted");
@@ -108,12 +106,10 @@ namespace MonoTests.System.Security.Permissions {
Assert.AreEqual (filename, attr.PathDiscovery, "All=PathDiscovery");
Assert.AreEqual (filename, attr.Read, "All=Read");
Assert.AreEqual (filename, attr.Write, "All=Write");
#if NET_2_0
Assert.IsNotNull (attr.AllFiles, "AllFiles");
Assert.IsNotNull (attr.AllLocalFiles, "AllLocalFiles");
Assert.IsNull (attr.ChangeAccessControl, "ChangeAccessControl");
Assert.IsNull (attr.ViewAccessControl, "ViewAccessControl");
#endif
FileIOPermission p = (FileIOPermission)attr.CreatePermission ();
filename = Path.GetFullPath (filename);
Assert.AreEqual (filename, p.GetPathList (FileIOPermissionAccess.Append) [0], "All=FileIOPermissionAttribute-Append");
@@ -140,12 +136,10 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsNull (attr.PathDiscovery, "PathDiscovery=null");
Assert.IsNull (attr.Read, "Read=null");
Assert.IsNull (attr.Write, "Write=null");
#if NET_2_0
Assert.IsNotNull (attr.AllFiles, "AllFiles");
Assert.IsNotNull (attr.AllLocalFiles, "AllLocalFiles");
Assert.IsNull (attr.ChangeAccessControl, "ChangeAccessControl");
Assert.IsNull (attr.ViewAccessControl, "ViewAccessControl");
#endif
FileIOPermission p = (FileIOPermission)attr.CreatePermission ();
filename = Path.GetFullPath (filename);
Assert.AreEqual (filename, p.GetPathList (FileIOPermissionAccess.Append) [0], "Append=FileIOPermissionAttribute-Append");
@@ -164,12 +158,10 @@ namespace MonoTests.System.Security.Permissions {
Assert.AreEqual (filename, attr.PathDiscovery, "PathDiscovery=PathDiscovery");
Assert.IsNull (attr.Read, "Read=null");
Assert.IsNull (attr.Write, "Write=null");
#if NET_2_0
Assert.IsNotNull (attr.AllFiles, "AllFiles");
Assert.IsNotNull (attr.AllLocalFiles, "AllLocalFiles");
Assert.IsNull (attr.ChangeAccessControl, "ChangeAccessControl");
Assert.IsNull (attr.ViewAccessControl, "ViewAccessControl");
#endif
FileIOPermission p = (FileIOPermission)attr.CreatePermission ();
filename = Path.GetFullPath (filename);
Assert.IsNull (p.GetPathList (FileIOPermissionAccess.Append), "PathDiscovery=FileIOPermissionAttribute-Append");
@@ -188,12 +180,10 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsNull (attr.PathDiscovery, "PathDiscovery=null");
Assert.AreEqual (filename, attr.Read, "Read=Read");
Assert.IsNull (attr.Write, "Write=null");
#if NET_2_0
Assert.IsNotNull (attr.AllFiles, "AllFiles");
Assert.IsNotNull (attr.AllLocalFiles, "AllLocalFiles");
Assert.IsNull (attr.ChangeAccessControl, "ChangeAccessControl");
Assert.IsNull (attr.ViewAccessControl, "ViewAccessControl");
#endif
FileIOPermission p = (FileIOPermission)attr.CreatePermission ();
filename = Path.GetFullPath (filename);
Assert.IsNull (p.GetPathList (FileIOPermissionAccess.Append), "PathDiscovery=FileIOPermissionAttribute-Append");
@@ -202,7 +192,6 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsNull (p.GetPathList (FileIOPermissionAccess.Write), "PathDiscovery=FileIOPermissionAttribute-Write");
}
#if NET_2_0
[Test]
public void ChangeAccessControl ()
{
@@ -274,7 +263,6 @@ namespace MonoTests.System.Security.Permissions {
a.ViewAndModify = "mono";
Assert.AreEqual ("ViewAndModify", "mono", a.ViewAndModify);
}
#endif
[Test]
public void Write ()

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;
@@ -107,4 +106,3 @@ namespace MonoTests.System.Security.Permissions {
}
}
#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;
@@ -238,4 +237,3 @@ namespace MonoTests.System.Security.Permissions {
}
}
#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;
@@ -360,4 +359,3 @@ namespace MonoTests.System.Security.Permissions {
}
}
#endif

View File

@@ -127,58 +127,37 @@ namespace MonoTests.System.Security.Permissions {
public void PublisherIdentity ()
{
IPermission p = (IPermission) new PublisherIdentityPermission (PermissionState.None);
#if NET_2_0
Assert.AreEqual (10, GetTokenIndex (p));
#else
Assert.AreEqual (9, GetTokenIndex (p));
#endif
}
[Test]
public void SiteIdentity ()
{
IPermission p = (IPermission) new SiteIdentityPermission (PermissionState.None);
#if NET_2_0
Assert.AreEqual (11, GetTokenIndex (p));
#else
Assert.AreEqual (10, GetTokenIndex (p));
#endif
}
[Test]
public void StrongNameIdentity ()
{
IPermission p = (IPermission) new StrongNameIdentityPermission (PermissionState.None);
#if NET_2_0
Assert.AreEqual (12, GetTokenIndex (p));
#else
Assert.AreEqual (11, GetTokenIndex (p));
#endif
}
[Test]
public void UrlIdentity ()
{
IPermission p = (IPermission) new UrlIdentityPermission (PermissionState.None);
#if NET_2_0
Assert.AreEqual (13, GetTokenIndex (p));
#else
Assert.AreEqual (12, GetTokenIndex (p));
#endif
}
[Test]
public void ZoneIdentity ()
{
IPermission p = (IPermission) new ZoneIdentityPermission (PermissionState.None);
#if NET_2_0
Assert.AreEqual (14, GetTokenIndex (p));
#else
Assert.AreEqual (13, GetTokenIndex (p));
#endif
}
#if NET_2_0
[Test]
public void GacIdentity ()
{
@@ -192,6 +171,5 @@ namespace MonoTests.System.Security.Permissions {
IPermission p = (IPermission)new KeyContainerPermission (PermissionState.None);
Assert.AreEqual (16, GetTokenIndex (p));
}
#endif
}
}

View File

@@ -200,7 +200,6 @@ namespace MonoTests.System.Security.Permissions {
intersect = (IsolatedStorageFilePermission)union.Intersect (small);
Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-2");
Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-2");
#if NET_2_0
small.UsageAllowed = IsolatedStorageContainment.ApplicationIsolationByUser;
small.UserQuota = 3;
union = (IsolatedStorageFilePermission)union.Union (small);
@@ -252,7 +251,6 @@ namespace MonoTests.System.Security.Permissions {
intersect = (IsolatedStorageFilePermission)union.Intersect (small);
Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-6");
Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-6");
#endif
small.UsageAllowed = IsolatedStorageContainment.DomainIsolationByRoamingUser;
small.UserQuota = 7;
union = (IsolatedStorageFilePermission)union.Union (small);
@@ -280,7 +278,6 @@ namespace MonoTests.System.Security.Permissions {
Assert.AreEqual (IsolatedStorageContainment.AssemblyIsolationByRoamingUser, union.UsageAllowed, "AssemblyIsolationByRoamingUser");
Assert.AreEqual (7, union.UserQuota, "7c");
Assert.IsFalse (union.IsUnrestricted (), "IsUnrestricted-7c");
#if NET_2_0
small.UsageAllowed = IsolatedStorageContainment.ApplicationIsolationByRoamingUser;
small.UserQuota = 8;
union = (IsolatedStorageFilePermission)union.Union (small);
@@ -293,7 +290,6 @@ namespace MonoTests.System.Security.Permissions {
intersect = (IsolatedStorageFilePermission)union.Intersect (small);
Assert.AreEqual (small.UsageAllowed, intersect.UsageAllowed, "Intersect-UsageAllowed-8");
Assert.AreEqual (small.UserQuota, intersect.UserQuota, "Intersect-UserQuota-8");
#endif
small.UsageAllowed = IsolatedStorageContainment.AdministerIsolatedStorageByUser;
small.UserQuota = 9;
union = (IsolatedStorageFilePermission)union.Union (small);

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;
@@ -204,4 +203,3 @@ namespace MonoTests.System.Security.Permissions {
}
}
#endif

View File

@@ -45,9 +45,7 @@ namespace MonoTests.System.Security.Permissions {
{
PermissionSetAttribute a = new PermissionSetAttribute (SecurityAction.Assert);
Assert.IsNull (a.File, "File");
#if NET_2_0
Assert.IsNull (a.Hex, "Hex");
#endif
Assert.IsNull (a.Name, "Name");
Assert.IsNull (a.XML, "XML");
Assert.IsFalse (a.UnicodeEncoded, "UnicodeEncoded");
@@ -97,21 +95,16 @@ namespace MonoTests.System.Security.Permissions {
PermissionSetAttribute a = new PermissionSetAttribute (SecurityAction.Assert);
a.File = "mono";
Assert.AreEqual ("mono", a.File, "File");
#if NET_2_0
Assert.IsNull (a.Hex, "Hex");
#endif
Assert.IsNull (a.Name, "Name");
Assert.IsNull (a.XML, "XML");
a.File = null;
Assert.IsNull (a.File, "File");
#if NET_2_0
Assert.IsNull (a.Hex, "Hex");
#endif
Assert.IsNull (a.Name, "Name");
Assert.IsNull (a.XML, "XML");
}
#if NET_2_0
[Test]
public void Hex ()
{
@@ -176,7 +169,6 @@ namespace MonoTests.System.Security.Permissions {
PermissionSet psbeu = a.CreatePermissionSet ();
Assert.IsTrue (ps.Equals (psbeu), "HEX-BIGENDIAN-UNICODE");
}
#endif
[Test]
public void Name ()
@@ -184,16 +176,12 @@ namespace MonoTests.System.Security.Permissions {
PermissionSetAttribute a = new PermissionSetAttribute (SecurityAction.Assert);
a.Name = "mono";
Assert.IsNull (a.File, "File");
#if NET_2_0
Assert.IsNull (a.Hex, "Hex");
#endif
Assert.AreEqual ("mono", a.Name, "Name");
Assert.IsNull (a.XML, "XML");
a.Name = null;
Assert.IsNull (a.File, "File");
#if NET_2_0
Assert.IsNull (a.Hex, "Hex");
#endif
Assert.IsNull (a.Name, "Name");
Assert.IsNull (a.XML, "XML");
}
@@ -204,16 +192,12 @@ namespace MonoTests.System.Security.Permissions {
PermissionSetAttribute a = new PermissionSetAttribute (SecurityAction.Assert);
a.XML = "mono";
Assert.IsNull (a.File, "File");
#if NET_2_0
Assert.IsNull (a.Hex, "Hex");
#endif
Assert.IsNull (a.Name, "Name");
Assert.AreEqual ("mono", a.XML, "XML");
a.XML = null;
Assert.IsNull (a.File, "File");
#if NET_2_0
Assert.IsNull (a.Hex, "Hex");
#endif
Assert.IsNull (a.Name, "Name");
Assert.IsNull (a.XML, "XML");
}
@@ -234,9 +218,7 @@ namespace MonoTests.System.Security.Permissions {
PermissionSetAttribute a = new PermissionSetAttribute (SecurityAction.Assert);
a.Unrestricted = true;
Assert.IsNull (a.File, "File");
#if NET_2_0
Assert.IsNull (a.Hex, "Hex");
#endif
Assert.IsNull (a.Name, "Name");
Assert.IsNull (a.XML, "XML");

View File

@@ -208,11 +208,7 @@ namespace MonoTests.System.Security.Permissions {
}
[Test]
#if !NET_2_0
[ExpectedException (typeof (ArgumentException))]
#else
[Category ("NotWorking")]
#endif
public void Unrestricted ()
{
PublisherIdentityPermissionAttribute a = new PublisherIdentityPermissionAttribute (SecurityAction.Assert);

View File

@@ -101,7 +101,6 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsNull (se.Attribute("Unrestricted"), "ToXml-Unrestricted");
Assert.IsNull (p.Certificate, "Certificate==null");
}
#if NET_2_0
[Test]
[Category ("NotWorking")]
public void PermissionStateUnrestricted ()
@@ -118,15 +117,6 @@ namespace MonoTests.System.Security.Permissions {
// and they aren't equals to None
Assert.IsTrue (!p.Equals (new PublisherIdentityPermission (PermissionState.None)));
}
#else
[Test]
[ExpectedException (typeof (ArgumentException))]
public void PermissionStateUnrestricted ()
{
// Unrestricted isn't permitted for identity permissions
PublisherIdentityPermission p = new PublisherIdentityPermission (PermissionState.Unrestricted);
}
#endif
[Test]
public void Certificate ()
{
@@ -231,16 +221,13 @@ namespace MonoTests.System.Security.Permissions {
}
[Test]
#if NET_2_0
[Category ("NotWorking")]
#endif
public void Union_DifferentCertificates ()
{
PublisherIdentityPermission p1 = new PublisherIdentityPermission (x509);
X509Certificate x2 = new X509Certificate (cert2);
PublisherIdentityPermission p2 = new PublisherIdentityPermission (x2);
IPermission p = p1.Union (p2);
#if NET_2_0
// new XML format is used to contain more than one X.509 certificate
SecurityElement se = p.ToXml ();
Assert.AreEqual (2, se.Children.Count, "Childs");
@@ -248,9 +235,6 @@ namespace MonoTests.System.Security.Permissions {
Assert.AreEqual ((se.Children [1] as SecurityElement).Attribute ("X509v3Certificate"), p2.ToXml ().Attribute ("X509v3Certificate"), "Cert#2");
// strangely it is still versioned as 'version="1"'.
Assert.AreEqual ("1", se.Attribute ("version"), "Version");
#else
Assert.IsNull (p, "cert1 U cert2 == null");
#endif
}
[Test]

View File

@@ -45,23 +45,15 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsNull (a.Create, "Create");
Assert.IsNull (a.Read, "Read");
Assert.IsNull (a.Write, "Write");
#if NET_2_0
Assert.IsNull (a.ChangeAccessControl, "ChangeAccessControl");
Assert.IsNull (a.ViewAccessControl, "ViewAccessControl");
#endif
Assert.AreEqual (a.ToString (), a.TypeId.ToString (), "TypeId");
Assert.IsFalse (a.Unrestricted, "Unrestricted");
RegistryPermission perm = (RegistryPermission) a.CreatePermission ();
#if NET_2_0
Assert.AreEqual (String.Empty, perm.GetPathList (RegistryPermissionAccess.Create), "Create");
Assert.AreEqual (String.Empty, perm.GetPathList (RegistryPermissionAccess.Read), "Read");
Assert.AreEqual (String.Empty, perm.GetPathList (RegistryPermissionAccess.Write), "Write");
#else
Assert.IsNull (perm.GetPathList (RegistryPermissionAccess.Create), "Create");
Assert.IsNull (perm.GetPathList (RegistryPermissionAccess.Read), "Read");
Assert.IsNull (perm.GetPathList (RegistryPermissionAccess.Write), "Write");
#endif
}
[Test]
@@ -102,19 +94,15 @@ namespace MonoTests.System.Security.Permissions {
Assert.AreEqual ("mono", a.Create, "Create");
Assert.AreEqual ("mono", a.Read, "Read");
Assert.AreEqual ("mono", a.Write, "Write");
#if NET_2_0
Assert.IsNull (a.ChangeAccessControl, "ChangeAccessControl");
Assert.IsNull (a.ViewAccessControl, "ViewAccessControl");
#endif
a.All = null;
Assert.IsNull (a.Create, "Create");
Assert.IsNull (a.Read, "Read");
Assert.IsNull (a.Write, "Write");
#if NET_2_0
Assert.IsNull (a.ChangeAccessControl, "ChangeAccessControl");
Assert.IsNull (a.ViewAccessControl, "ViewAccessControl");
#endif
}
[Test]
@@ -134,19 +122,15 @@ namespace MonoTests.System.Security.Permissions {
Assert.AreEqual ("mono", a.Create, "Create");
Assert.IsNull (a.Read, "Read");
Assert.IsNull (a.Write, "Write");
#if NET_2_0
Assert.IsNull (a.ChangeAccessControl, "ChangeAccessControl");
Assert.IsNull (a.ViewAccessControl, "ViewAccessControl");
#endif
a.Create = null;
Assert.IsNull (a.Create, "Create");
Assert.IsNull (a.Read, "Read");
Assert.IsNull (a.Write, "Write");
#if NET_2_0
Assert.IsNull (a.ChangeAccessControl, "ChangeAccessControl");
Assert.IsNull (a.ViewAccessControl, "ViewAccessControl");
#endif
}
[Test]
@@ -157,22 +141,17 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsNull (a.Create, "Create");
Assert.AreEqual ("mono", a.Read, "Read");
Assert.IsNull (a.Write, "Write");
#if NET_2_0
Assert.IsNull (a.ChangeAccessControl, "ChangeAccessControl");
Assert.IsNull (a.ViewAccessControl, "ViewAccessControl");
#endif
a.Read = null;
Assert.IsNull (a.Create, "Create");
Assert.IsNull (a.Read, "Read");
Assert.IsNull (a.Write, "Write");
#if NET_2_0
Assert.IsNull (a.ChangeAccessControl, "ChangeAccessControl");
Assert.IsNull (a.ViewAccessControl, "ViewAccessControl");
#endif
}
#if NET_2_0
[Test]
public void ChangeAccessControl ()
{
@@ -238,7 +217,6 @@ namespace MonoTests.System.Security.Permissions {
a.ViewAndModify = "mono";
Assert.AreEqual ("ViewAndModify", "mono", a.ViewAndModify);
}
#endif
[Test]
public void Write ()
@@ -248,19 +226,15 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsNull (a.Create, "Create");
Assert.IsNull (a.Read, "Read");
Assert.AreEqual ("mono", a.Write, "Write");
#if NET_2_0
Assert.IsNull (a.ChangeAccessControl, "ChangeAccessControl");
Assert.IsNull (a.ViewAccessControl, "ViewAccessControl");
#endif
a.Write = null;
Assert.IsNull (a.Create, "Create");
Assert.IsNull (a.Read, "Read");
Assert.IsNull (a.Write, "Write");
#if NET_2_0
Assert.IsNull (a.ChangeAccessControl, "ChangeAccessControl");
Assert.IsNull (a.ViewAccessControl, "ViewAccessControl");
#endif
}
[Test]

View File

@@ -167,15 +167,10 @@ namespace MonoTests.System.Security.Permissions {
public void GetPathList ()
{
RegistryPermission ep = new RegistryPermission (PermissionState.None);
#if NET_2_0
Assert.AreEqual (String.Empty, ep.GetPathList (RegistryPermissionAccess.Create), "GetPathList-Create-Empty");
Assert.AreEqual (String.Empty, ep.GetPathList (RegistryPermissionAccess.Read), "GetPathList-Read-Empty");
Assert.AreEqual (String.Empty, ep.GetPathList (RegistryPermissionAccess.Write), "GetPathList-Write-Empty");
#else
Assert.IsNull (ep.GetPathList (RegistryPermissionAccess.Create), "GetPathList-Create-Empty");
Assert.IsNull (ep.GetPathList (RegistryPermissionAccess.Read), "GetPathList-Read-Empty");
Assert.IsNull (ep.GetPathList (RegistryPermissionAccess.Write), "GetPathList-Write-Empty");
#endif
ep.AddPathList (RegistryPermissionAccess.Create, keyLocalMachine);
ep.AddPathList (RegistryPermissionAccess.Create, keyCurrentUser);
Assert.AreEqual (keyLocalMachine + ";" + keyCurrentUser, ep.GetPathList (RegistryPermissionAccess.Create), "GetPathList-Read");
@@ -235,9 +230,7 @@ namespace MonoTests.System.Security.Permissions {
ep.FromXml (se2);
}
#if NET_2_0
[Category ("NotWorking")]
#endif
[Test]
public void FromXml ()
{
@@ -279,9 +272,7 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsTrue (ep3.IsUnrestricted (), "EP2 U Unrestricted == Unrestricted");
}
#if NET_2_0
[Category ("NotWorking")]
#endif
[Test]
public void Union ()
{
@@ -294,9 +285,7 @@ namespace MonoTests.System.Security.Permissions {
Assert.AreEqual (ep4.ToXml ().ToString (), ep5.ToXml ().ToString (), "EP1 U EP2 U EP3 == EP1+2+3");
}
#if NET_2_0
[Category ("NotWorking")]
#endif
[Test]
public void Union_Subset ()
{
@@ -364,9 +353,7 @@ namespace MonoTests.System.Security.Permissions {
Assert.AreEqual (keyLocalMachine, ep3.GetPathList (RegistryPermissionAccess.Write), "Intersect-AllAccess-Write");
}
#if NET_2_0
[Category ("NotWorking")]
#endif
[Test]
public void Intersect_Subset ()
{

View File

@@ -46,9 +46,7 @@ namespace MonoTests.System.Security.Permissions {
{
SecurityPermissionAttribute a = new SecurityPermissionAttribute (SecurityAction.Assert);
Assert.IsFalse (a.Assertion, "Assertion");
#if NET_2_0
Assert.IsFalse (a.BindingRedirects, "BindingRedirects");
#endif
Assert.IsFalse (a.ControlAppDomain, "ControlAppDomain");
Assert.IsFalse (a.ControlDomainPolicy, "ControlDomainPolicy");
Assert.IsFalse (a.ControlEvidence, "ControlEvidence");
@@ -104,9 +102,7 @@ namespace MonoTests.System.Security.Permissions {
{
SecurityPermissionAttribute a = new SecurityPermissionAttribute (SecurityAction.Assert);
a.Assertion = false;
#if NET_2_0
a.BindingRedirects = false;
#endif
a.ControlAppDomain = false;
a.ControlDomainPolicy = false;
a.ControlEvidence = false;
@@ -132,7 +128,6 @@ namespace MonoTests.System.Security.Permissions {
a.Assertion = false;
Assert.AreEqual (SecurityPermissionFlag.NoFlags, a.Flags, "Flags=NoFlags");
}
#if NET_2_0
[Test]
public void BindingRedirects ()
{
@@ -142,7 +137,6 @@ namespace MonoTests.System.Security.Permissions {
a.BindingRedirects = false;
Assert.AreEqual (SecurityPermissionFlag.NoFlags, a.Flags, "Flags=NoFlags");
}
#endif
[Test]
public void ControlAppDomain ()
{
@@ -280,10 +274,8 @@ namespace MonoTests.System.Security.Permissions {
SecurityPermissionAttribute a = new SecurityPermissionAttribute (SecurityAction.Assert);
a.Flags = SecurityPermissionFlag.Assertion;
Assert.IsTrue (a.Assertion, "Assertion");
#if NET_2_0
a.Flags |= SecurityPermissionFlag.BindingRedirects;
Assert.IsTrue (a.BindingRedirects, "BindingRedirects");
#endif
a.Flags |= SecurityPermissionFlag.ControlAppDomain;
Assert.IsTrue (a.ControlAppDomain, "ControlAppDomain");
a.Flags |= SecurityPermissionFlag.ControlDomainPolicy;
@@ -313,10 +305,8 @@ namespace MonoTests.System.Security.Permissions {
a.Flags &= ~SecurityPermissionFlag.Assertion;
Assert.IsFalse (a.Assertion, "Assertion-False");
#if NET_2_0
a.Flags &= ~SecurityPermissionFlag.BindingRedirects;
Assert.IsFalse (a.BindingRedirects, "BindingRedirects-False");
#endif
a.Flags &= ~SecurityPermissionFlag.ControlAppDomain;
Assert.IsFalse (a.ControlAppDomain, "ControlAppDomain-False");
a.Flags &= ~SecurityPermissionFlag.ControlDomainPolicy;

View File

@@ -48,11 +48,7 @@ namespace MonoTests.System.Security.Permissions {
}
[Test]
#if !NET_2_0
[ExpectedException (typeof (NullReferenceException))]
#else
[Category ("NotWorking")]
#endif
public void DefaultPermission ()
{
SiteIdentityPermissionAttribute a = new SiteIdentityPermissionAttribute (SecurityAction.Assert);
@@ -108,11 +104,7 @@ namespace MonoTests.System.Security.Permissions {
}
[Test]
#if !NET_2_0
[ExpectedException (typeof (ArgumentException))]
#else
[Category ("NotWorking")]
#endif
public void Unrestricted ()
{
SiteIdentityPermissionAttribute a = new SiteIdentityPermissionAttribute (SecurityAction.Assert);

View File

@@ -56,16 +56,12 @@ namespace MonoTests.System.Security.Permissions {
"www.*.com",
};
#if NET_2_0
[Category ("NotWorking")]
#endif
[Test]
public void PermissionState_None ()
{
SiteIdentityPermission sip = new SiteIdentityPermission (PermissionState.None);
#if NET_2_0
Assert.AreEqual (String.Empty, sip.Site, "Site");
#endif
SecurityElement se = sip.ToXml ();
// only class and version are present
Assert.AreEqual (2, se.Attributes.Count, "Xml-Attributes");
@@ -74,7 +70,6 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsFalse (Object.ReferenceEquals (sip, copy), "ReferenceEquals");
}
#if NET_2_0
[Category ("NotWorking")]
[Test]
public void PermissionStateUnrestricted ()
@@ -90,14 +85,6 @@ namespace MonoTests.System.Security.Permissions {
// and they aren't equals to None
Assert.IsFalse (sip.Equals (new SiteIdentityPermission (PermissionState.None)));
}
#else
[Test]
[ExpectedException (typeof (ArgumentException))]
public void PermissionState_Unrestricted ()
{
SiteIdentityPermission sip = new SiteIdentityPermission (PermissionState.Unrestricted);
}
#endif
[Test]
[ExpectedException (typeof (ArgumentException))]
public void PermissionState_Bad ()
@@ -317,35 +304,21 @@ namespace MonoTests.System.Security.Permissions {
Assert.AreEqual (s, union.Site, s);
}
}
#if NET_2_0
[Category ("NotWorking")]
#endif
[Test]
public void Union_Self ()
{
SiteIdentityPermission sip = new SiteIdentityPermission (PermissionState.None);
SiteIdentityPermission union = (SiteIdentityPermission)sip.Union (sip);
#if NET_2_0
Assert.IsNull (union, "None U None");
#else
Assert.IsNotNull (union, "None U None"); // can't get null Site property
foreach (string s in GoodSites) {
sip.Site = s;
union = (SiteIdentityPermission)sip.Union (sip);
Assert.AreEqual (s, union.Site, s);
}
#endif
}
#if NET_2_0
[Category ("NotWorking")]
#endif
[Test]
public void Union_Different ()
{
SiteIdentityPermission sip1 = new SiteIdentityPermission (GoodSites [0]);
SiteIdentityPermission sip2 = new SiteIdentityPermission (GoodSites [1]);
SiteIdentityPermission result = (SiteIdentityPermission)sip1.Union (sip2);
#if NET_2_0
Assert.IsNotNull (result, "Mono U Novell");
// new XML format is used to contain more than one site
SecurityElement se = result.ToXml ();
@@ -354,12 +327,7 @@ namespace MonoTests.System.Security.Permissions {
Assert.AreEqual ((se.Children [1] as SecurityElement).Attribute ("Site"), sip2.Site, "Site#2");
// strangely it is still versioned as 'version="1"'.
Assert.AreEqual ("1", se.Attribute ("version"), "Version");
#else
// It's null for FX 1.0 and 1.1
Assert.IsNull (result, "Mono U Novell");
#endif
}
#if NET_2_0
[Test]
[Category ("NotWorking")]
[ExpectedException (typeof (NotSupportedException))]
@@ -371,7 +339,6 @@ namespace MonoTests.System.Security.Permissions {
// it's not possible to return many sites using the Site property so it throws
Assert.IsNull (result.Site);
}
#endif
[Test]
[ExpectedException (typeof (ArgumentNullException))]
public void FromXml_Null ()

View File

@@ -199,11 +199,7 @@ namespace MonoTests.System.Security.Permissions {
}
[Test]
#if !NET_2_0
[ExpectedException (typeof (ArgumentException))]
#else
[Category ("NotWorking")]
#endif
public void Unrestricted ()
{
StrongNameIdentityPermissionAttribute a = new StrongNameIdentityPermissionAttribute (SecurityAction.Assert);

View File

@@ -39,7 +39,6 @@ namespace MonoTests.System.Security.Permissions {
static byte[] ecma = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#if NET_2_0
private StrongNameIdentityPermission GetUnion ()
{
StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
@@ -48,7 +47,6 @@ namespace MonoTests.System.Security.Permissions {
StrongNameIdentityPermission diffPk = new StrongNameIdentityPermission (blob2, "mono", new Version (1, 2, 3, 4));
return (StrongNameIdentityPermission)snip.Union (diffPk);
}
#endif
[Test]
public void PermissionStateNone ()
@@ -59,27 +57,17 @@ namespace MonoTests.System.Security.Permissions {
Assert.AreEqual ("0.0", snip.Version.ToString (), "Version");
SecurityElement se = snip.ToXml ();
#if NET_2_0
Assert.IsNull (se.Attribute ("Name"), "Xml-Name");
Assert.IsNull (se.Attribute ("AssemblyVersion"), "Xml-AssemblyVersion");
#else
Assert.AreEqual (String.Empty, se.Attribute ("Name"), "Xml-Name");
Assert.AreEqual ("0.0", se.Attribute ("AssemblyVersion"), "Xml-AssemblyVersion");
#endif
Assert.IsNull (se.Attribute ("PublicKeyBlob"), "Xml-PublicKeyBlob");
// because Name == String.Empty, which is illegal using the other constructor
StrongNameIdentityPermission copy = (StrongNameIdentityPermission) snip.Copy ();
Assert.AreEqual (String.Empty, copy.Name, "Copy-Name");
#if NET_2_0
// Strangely once copied the Name becomes equals to String.Empty in 2.0 [FDBK19351]
Assert.IsNull (se.Attribute ("AssemblyVersion"), "Copy-Version");
#else
Assert.AreEqual ("0.0", copy.Version.ToString (), "Copy-Version");
#endif
Assert.IsNull (copy.PublicKey, "Copy-PublicKey");
}
#if NET_2_0
[Test]
public void PermissionStateUnrestricted ()
{
@@ -98,14 +86,6 @@ namespace MonoTests.System.Security.Permissions {
// and they aren't equals to None
Assert.IsFalse (snip.Equals (new StrongNameIdentityPermission (PermissionState.None)), "Not Equals None");
}
#else
[Test]
[ExpectedException (typeof (ArgumentException))]
public void PermissionStateUnrestricted ()
{
StrongNameIdentityPermission snip = new StrongNameIdentityPermission (PermissionState.Unrestricted);
}
#endif
[Test]
[ExpectedException (typeof (ArgumentException))]
public void PermissionStateInvalid ()
@@ -142,9 +122,7 @@ namespace MonoTests.System.Security.Permissions {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void StrongNameIdentityPermission_NameEmpty ()
{
StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
@@ -204,20 +182,14 @@ namespace MonoTests.System.Security.Permissions {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void Name_Empty ()
{
StrongNamePublicKeyBlob blob = new StrongNamePublicKeyBlob (ecma);
StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
snip.Name = String.Empty;
#if !NET_2_0
Assert.AreEqual (String.Empty, snip.Name, "Name");
#endif
}
#if NET_2_0
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void Name_Multiple_Get ()
@@ -235,7 +207,6 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsNull (union.PublicKey, "PublicKey");
Assert.AreEqual ("0.0", union.Version.ToString (), "Version");
}
#endif
[Test]
[ExpectedException (typeof (ArgumentNullException))]
@@ -245,7 +216,6 @@ namespace MonoTests.System.Security.Permissions {
StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
snip.PublicKey = null;
}
#if NET_2_0
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void PublicKey_Multiple_Get ()
@@ -263,7 +233,6 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsNotNull (union.PublicKey, "PublicKey");
Assert.AreEqual ("0.0", union.Version.ToString (), "Version");
}
#endif
[Test]
public void Version ()
{
@@ -275,7 +244,6 @@ namespace MonoTests.System.Security.Permissions {
snip.Version = new Version (1, 2, 3);
Assert.AreEqual ("1.2.3", snip.Version.ToString (), "Version-3");
}
#if NET_2_0
[Test]
[ExpectedException (typeof (NotSupportedException))]
public void Version_Multiple_Get ()
@@ -293,7 +261,6 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsNull (union.PublicKey, "PublicKey");
Assert.AreEqual ("1.2.3.4", union.Version.ToString (), "Version");
}
#endif
[Test]
public void Copy_NameEmpty ()
{
@@ -304,11 +271,7 @@ namespace MonoTests.System.Security.Permissions {
// because Name == String.Empty, which is illegal using the other constructor
// but (somewhat) required to copy the teo other informations
StrongNameIdentityPermission copy = (StrongNameIdentityPermission)snip.Copy ();
#if NET_2_0
Assert.IsTrue (copy.Equals (snip), "Equals");
#else
Assert.AreEqual (copy.ToXml ().ToString (), snip.ToXml ().ToString (), "Equals-XML");
#endif
}
private void Compare (StrongNameIdentityPermission p1, StrongNameIdentityPermission p2, string prefix)
@@ -330,11 +293,7 @@ namespace MonoTests.System.Security.Permissions {
StrongNameIdentityPermission empty = new StrongNameIdentityPermission (PermissionState.None);
intersect = (StrongNameIdentityPermission)snip.Intersect (empty);
#if NET_2_0
Assert.IsNull (intersect, "snip N empty");
#else
Compare (empty, intersect, "snip U empty");
#endif
intersect = (StrongNameIdentityPermission)snip.Intersect (snip);
Compare (snip, intersect, "snip U snip");
@@ -345,9 +304,7 @@ namespace MonoTests.System.Security.Permissions {
}
[Test]
#if NET_2_0
[ExpectedException (typeof (ArgumentException))]
#endif
public void Intersect_DifferentPermissions ()
{
StrongNameIdentityPermission a = new StrongNameIdentityPermission (PermissionState.None);
@@ -415,17 +372,9 @@ namespace MonoTests.System.Security.Permissions {
StrongNameIdentityPermission samePk = new StrongNameIdentityPermission (blob, null, null);
union = (StrongNameIdentityPermission)snip.Union (samePk);
#if !NET_2_0
// can't compare the properties with multiple entries
Compare (snip, union, "snip U samePk");
#endif
Assert.IsTrue (snip.IsSubsetOf (union), "snip.IsSubsetOf (union)");
union = (StrongNameIdentityPermission)samePk.Union (snip);
#if !NET_2_0
// can't compare the properties with multiple entries
Compare (snip, union, "samePk U snip");
#endif
Assert.IsTrue (samePk.IsSubsetOf (union), "snip.IsSubsetOf (union)");
}
@@ -437,7 +386,6 @@ namespace MonoTests.System.Security.Permissions {
StrongNamePublicKeyBlob blob2 = new StrongNamePublicKeyBlob (new byte [16]);
StrongNameIdentityPermission diffPk = new StrongNameIdentityPermission (blob2, "mono", new Version (1, 2, 3, 4));
StrongNameIdentityPermission result = (StrongNameIdentityPermission) snip.Union (diffPk);
#if NET_2_0
Assert.IsNotNull (result, "DifferentPk");
// new XML format is used to contain more than one site
SecurityElement se = result.ToXml ();
@@ -446,9 +394,6 @@ namespace MonoTests.System.Security.Permissions {
Assert.AreEqual ("00000000000000000000000000000000", (se.Children [1] as SecurityElement).Attribute ("PublicKeyBlob"), "Blob#2");
// strangely it is still versioned as 'version="1"'.
Assert.AreEqual ("1", se.Attribute ("version"), "Version");
#else
Assert.IsNull (result, "DifferentPk");
#endif
}
[Test]
@@ -458,7 +403,6 @@ namespace MonoTests.System.Security.Permissions {
StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
StrongNameIdentityPermission diffName = new StrongNameIdentityPermission (blob, "novell", null);
StrongNameIdentityPermission result = (StrongNameIdentityPermission) snip.Union (diffName);
#if NET_2_0
Assert.IsNotNull (result, "DifferentName");
// new XML format is used to contain more than one site
SecurityElement se = result.ToXml ();
@@ -467,9 +411,6 @@ namespace MonoTests.System.Security.Permissions {
Assert.AreEqual ("novell", (se.Children [1] as SecurityElement).Attribute ("Name"), "Name#2");
// strangely it is still versioned as 'version="1"'.
Assert.AreEqual ("1", se.Attribute ("version"), "Version");
#else
Assert.IsNull (result, "DifferentName");
#endif
}
[Test]
@@ -479,7 +420,6 @@ namespace MonoTests.System.Security.Permissions {
StrongNameIdentityPermission snip = new StrongNameIdentityPermission (blob, "mono", new Version (1, 2, 3, 4));
StrongNameIdentityPermission diffVersion = new StrongNameIdentityPermission (blob, null, new Version (1, 2));
StrongNameIdentityPermission result = (StrongNameIdentityPermission) snip.Union (diffVersion);
#if NET_2_0
Assert.IsNotNull (result, "DifferentVersion");
// new XML format is used to contain more than one site
SecurityElement se = result.ToXml ();
@@ -488,9 +428,6 @@ namespace MonoTests.System.Security.Permissions {
Assert.AreEqual ("1.2", (se.Children [1] as SecurityElement).Attribute ("AssemblyVersion"), "AssemblyVersion#2");
// strangely it is still versioned as 'version="1"'.
Assert.AreEqual ("1", se.Attribute ("version"), "Version");
#else
Assert.IsNull (result, "DifferentVersion");
#endif
}
[Test]

View File

@@ -48,9 +48,6 @@ namespace MonoTests.System.Security.Permissions {
}
[Test]
#if !NET_2_0
[ExpectedException (typeof (NullReferenceException))]
#endif
public void DefaultPermission ()
{
UrlIdentityPermissionAttribute a = new UrlIdentityPermissionAttribute (SecurityAction.Assert);
@@ -61,14 +58,10 @@ namespace MonoTests.System.Security.Permissions {
Assert.IsNotNull (perm, "CreatePermission(null url)");
// ... but this doesn't!
string url = perm.Url;
#if NET_2_0
Assert.AreEqual (String.Empty, url, "Url-2");
#endif
}
#if NET_2_0
[Category ("NotWorking")]
#endif
[Test]
public void Action ()
{
@@ -112,11 +105,7 @@ namespace MonoTests.System.Security.Permissions {
}
[Test]
#if !NET_2_0
[ExpectedException (typeof (ArgumentException))]
#else
[Category ("NotWorking")]
#endif
public void Unrestricted ()
{
UrlIdentityPermissionAttribute a = new UrlIdentityPermissionAttribute (SecurityAction.Assert);

Some files were not shown because too many files have changed in this diff Show More