CreateIdentityPermission() public method

public CreateIdentityPermission ( Evidence evidence ) : IPermission
evidence Evidence
return IPermission
Beispiel #1
0
		public void Intranet () 
		{
			Zone z = new Zone (SecurityZone.Intranet);
			Assert.AreEqual (SecurityZone.Intranet, z.SecurityZone, "Intranet.SecurityZone");
			Assert.IsTrue ((z.ToString ().IndexOf ("<Zone>Intranet</Zone>") >= 0), "Intranet.ToString");
			Zone zc = (Zone) z.Copy ();
			Assert.IsTrue (z.Equals (zc), "Intranet.Copy.Equals");
			IPermission p = z.CreateIdentityPermission (null);
			Assert.IsNotNull (p, "Intranet.CreateIdentityPermission");

			Assert.IsTrue (!z.Equals (new Zone (SecurityZone.MyComputer)), "Intranet.MyComputer.Equals");
			Assert.IsTrue (z.Equals (new Zone (SecurityZone.Intranet)), "Intranet.Intranet.Equals");
			Assert.IsTrue (!z.Equals (new Zone (SecurityZone.Trusted)), "Intranet.Trusted.Equals");
			Assert.IsTrue (!z.Equals (new Zone (SecurityZone.Internet)), "Intranet.Internet.Equals");
			Assert.IsTrue (!z.Equals (new Zone (SecurityZone.Untrusted)), "Intranet.Untrusted.Equals");
			Assert.IsTrue (!z.Equals (new Zone (SecurityZone.NoZone)), "Intranet.NoZone.Equals");
			Assert.IsTrue (!z.Equals (null), "Intranet.Null.Equals");
		}
		public void Intranet () 
		{
			Zone z = new Zone (SecurityZone.Intranet);
			AssertEquals ("Intranet.SecurityZone", SecurityZone.Intranet, z.SecurityZone);
			Assert ("Intranet.ToString", (z.ToString ().IndexOf ("<Zone>Intranet</Zone>") >= 0));
			Zone zc = (Zone) z.Copy ();
			Assert ("Intranet.Copy.Equals", z.Equals (zc));
			IPermission p = z.CreateIdentityPermission (null);
			AssertNotNull ("Intranet.CreateIdentityPermission", p);

			Assert ("Intranet.MyComputer.Equals", !z.Equals (new Zone (SecurityZone.MyComputer)));
			Assert ("Intranet.Intranet.Equals", z.Equals (new Zone (SecurityZone.Intranet)));
			Assert ("Intranet.Trusted.Equals", !z.Equals (new Zone (SecurityZone.Trusted)));
			Assert ("Intranet.Internet.Equals", !z.Equals (new Zone (SecurityZone.Internet)));
			Assert ("Intranet.Untrusted.Equals", !z.Equals (new Zone (SecurityZone.Untrusted)));
			Assert ("Intranet.NoZone.Equals", !z.Equals (new Zone (SecurityZone.NoZone)));
			Assert ("Intranet.Null.Equals", !z.Equals (null));
		}
Beispiel #3
0
		public void NoZone () 
		{
			Zone z = new Zone (SecurityZone.NoZone);
			Assert.AreEqual (SecurityZone.NoZone, z.SecurityZone, "NoZone.SecurityZone");
			Assert.IsTrue ((z.ToString ().IndexOf ("<Zone>NoZone</Zone>") >= 0), "NoZone.ToString");
			Zone zc = (Zone) z.Copy ();
			Assert.IsTrue (z.Equals (zc), "NoZone.Copy.Equals");
			IPermission p = z.CreateIdentityPermission (null);
			Assert.IsNotNull (p, "NoZone.CreateIdentityPermission");
			// NoZone isn't added to the XML / string of permissions
			Assert.IsTrue (p.ToString ().IndexOf ("NoZone") < 0, "ToString!=NoZone");

			Assert.IsTrue (!z.Equals (new Zone (SecurityZone.MyComputer)), "NoZone.MyComputer.Equals");
			Assert.IsTrue (!z.Equals (new Zone (SecurityZone.Intranet)), "NoZone.Intranet.Equals");
			Assert.IsTrue (!z.Equals (new Zone (SecurityZone.Trusted)), "NoZone.Trusted.Equals");
			Assert.IsTrue (!z.Equals (new Zone (SecurityZone.Internet)), "NoZone.Internet.Equals");
			Assert.IsTrue (!z.Equals (new Zone (SecurityZone.Untrusted)), "NoZone.Untrusted.Equals");
			Assert.IsTrue (z.Equals (new Zone (SecurityZone.NoZone)), "NoZone.NoZone.Equals");
			Assert.IsTrue (!z.Equals (null), "NoZone.Null.Equals");
		}
		public void NoZone () 
		{
			Zone z = new Zone (SecurityZone.NoZone);
			AssertEquals ("NoZone.SecurityZone", SecurityZone.NoZone, z.SecurityZone);
			Assert ("NoZone.ToString", (z.ToString ().IndexOf ("<Zone>NoZone</Zone>") >= 0));
			Zone zc = (Zone) z.Copy ();
			Assert ("NoZone.Copy.Equals", z.Equals (zc));
			IPermission p = z.CreateIdentityPermission (null);
			AssertNotNull ("NoZone.CreateIdentityPermission", p);
			// NoZone isn't added to the XML / string of permissions
			Assert ("ToString!=NoZone", p.ToString ().IndexOf ("NoZone") < 0);

			Assert ("NoZone.MyComputer.Equals", !z.Equals (new Zone (SecurityZone.MyComputer)));
			Assert ("NoZone.Intranet.Equals", !z.Equals (new Zone (SecurityZone.Intranet)));
			Assert ("NoZone.Trusted.Equals", !z.Equals (new Zone (SecurityZone.Trusted)));
			Assert ("NoZone.Internet.Equals", !z.Equals (new Zone (SecurityZone.Internet)));
			Assert ("NoZone.Untrusted.Equals", !z.Equals (new Zone (SecurityZone.Untrusted)));
			Assert ("NoZone.NoZone.Equals", z.Equals (new Zone (SecurityZone.NoZone)));
			Assert ("NoZone.Null.Equals", !z.Equals (null));
		}