CreateIdentityPermission() публичный Метод

public CreateIdentityPermission ( Evidence evidence ) : IPermission
evidence Evidence
Результат IPermission
Пример #1
0
		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");

			UrlIdentityPermission uip = (UrlIdentityPermission) u.CreateIdentityPermission (null);
			Assert.AreEqual (u.Value, uip.Url, "CreateIdentityPermission");

			Assert.IsTrue (u.Equals (u2), "Equals");
			Url u3 = new Url ("index.html");
			Assert.IsFalse (u.Equals (u3), "!Equals(*)");

			u2 = new Url ("file://*");
			Assert.AreEqual ("file://*", u2.Value, "Value-file://*");
			Assert.IsTrue (u.Equals (u2), "Equals-file://*");
		}
Пример #2
0
		public void Url_GoMonoWebUrl () 
		{
			string url = "http://www.go-mono.com";
			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");

			UrlIdentityPermission uip = (UrlIdentityPermission) u.CreateIdentityPermission (null);
			Assert.AreEqual (u.Value, uip.Url, "CreateIdentityPermission");

			Assert.IsTrue (u.Equals (u2), "Equals");
			Url u3 = new Url ("go-mono.com");
			Assert.IsFalse (u.Equals (u3), "!Equals");
		}