Inheritance: EvidenceBase, IIdentityPermissionFactory
Esempio n. 1
0
		public void Copy ()
		{
			GacInstalled gac = new GacInstalled ();
			GacInstalled copy = (GacInstalled)gac.Copy ();
			Assert.AreEqual (gac, copy, "Equals");
			Assert.IsFalse (Object.ReferenceEquals (gac, copy), "ReferenceEquals");
		}
Esempio n. 2
0
		public void Equals ()
		{
			GacInstalled gac = new GacInstalled ();
			Assert.IsFalse (gac.Equals (null), "Equals(null)");
			GacInstalled g2 = new GacInstalled ();
			Assert.IsTrue (gac.Equals (g2), "Equals(g2)");
			Assert.IsTrue (g2.Equals (gac), "Equals(gac)");
		}
Esempio n. 3
0
		public void CreateIdentityPermission ()
		{
			GacInstalled gac = new GacInstalled ();
			IPermission p = gac.CreateIdentityPermission (null);
			Assert.IsTrue ((p is GacIdentityPermission), "GacIdentityPermission");
			Assert.IsNotNull (p, "CreateIdentityPermission(null)");
			p = gac.CreateIdentityPermission (new Evidence ());
			Assert.IsNotNull (p, "CreateIdentityPermission(Evidence)");
		}
Esempio n. 4
0
 public static void GacInstalledCallMethods()
 {
     GacInstalled gi = new GacInstalled();
     object obj = gi.Copy();
     IPermission ip = gi.CreateIdentityPermission(new Evidence());
     bool check = gi.Equals(new object());
     int hash = gi.GetHashCode();
     string str = gi.ToString();
 }
		public void Check ()
		{
			GacMembershipCondition gac = new GacMembershipCondition ();
			Evidence e = null;
			Assert.IsFalse (gac.Check (e), "Check (null)");
			e = new Evidence ();
			Assert.IsFalse (gac.Check (e), "Check (empty)");
			e.AddHost (new Zone (SecurityZone.MyComputer));
			Assert.IsFalse (gac.Check (e), "Check (zone)");
			GacInstalled g = new GacInstalled ();
			e.AddAssembly (g);
			Assert.IsFalse (gac.Check (e), "Check (gac-assembly)");
			e.AddHost (g);
			Assert.IsTrue (gac.Check (e), "Check (gac-host)");
		}
Esempio n. 6
0
		public void GacInstalled_OutputToBuffer_Null ()
		{
			GacInstalled g = new GacInstalled ();
			OutputToBuffer (g, null, 0, false);
		}
Esempio n. 7
0
		public void GacInstalled_OutputToBuffer ()
		{
			char[] buffer = new char [2];
			GacInstalled g = new GacInstalled ();
			Assert.AreEqual (1, OutputToBuffer (g, buffer, 0, false), "OutputToBuffer-false");
			Assert.AreEqual ('\t', buffer [0], "Buffer-false");
			Assert.AreEqual (2, OutputToBuffer (g, buffer, 1, true), "OutputToBuffer-true");
			Assert.AreEqual ('\t', buffer [1], "Buffer-true");
		}
Esempio n. 8
0
		public void GacInstalled_InitFromBuffer_OutOfRange ()
		{
			char [] buffer = new char [1] { '\t' };
			GacInstalled g = new GacInstalled ();
			Assert.AreEqual (4, InitFromBuffer (g, buffer, 4), "InitFromBuffer");
		}
Esempio n. 9
0
		public void GacInstalled_InitFromBuffer_Null ()
		{
			GacInstalled g = new GacInstalled ();
			Assert.AreEqual (0, InitFromBuffer (g, null, 0), "InitFromBuffer");
		}
Esempio n. 10
0
		public void GacInstalled_InitFromBuffer_BadData ()
		{
			char [] buffer = new char [1] { '\r' };
			GacInstalled g = new GacInstalled ();
			Assert.AreEqual (0, InitFromBuffer (g, buffer, 0), "InitFromBuffer");
		}
Esempio n. 11
0
		public void GacInstalled_InitFromBuffer ()
		{
			char[] buffer = new char [2] { '\t', '\t' };
			GacInstalled g = new GacInstalled ();
			Assert.AreEqual (0, InitFromBuffer (g, buffer, 0), "InitFromBuffer-1");
			Assert.AreEqual (1, InitFromBuffer (g, buffer, 1), "InitFromBuffer-2");
		}
        internal Evidence(char[] buffer)
        {
            int position = 0;

            while (position < buffer.Length)
            {
                switch (buffer[position++])
                {
                case BuiltInEvidenceHelper.idApplicationDirectory:
                {
                    IBuiltInEvidence ad = new ApplicationDirectory();
                    position = ad.InitFromBuffer(buffer, position);
                    AddAssembly(ad);
                    break;
                }

                case BuiltInEvidenceHelper.idStrongName:
                {
                    IBuiltInEvidence sn = new StrongName();
                    position = sn.InitFromBuffer(buffer, position);
                    AddHost(sn);
                    break;
                }

                case BuiltInEvidenceHelper.idZone:
                {
                    IBuiltInEvidence z = new Zone();
                    position = z.InitFromBuffer(buffer, position);
                    AddHost(z);
                    break;
                }

                case BuiltInEvidenceHelper.idUrl:
                {
                    IBuiltInEvidence u = new Url();
                    position = u.InitFromBuffer(buffer, position);
                    AddHost(u);
                    break;
                }

                case BuiltInEvidenceHelper.idSite:
                {
                    IBuiltInEvidence s = new Site();
                    position = s.InitFromBuffer(buffer, position);
                    AddHost(s);
                    break;
                }

                case BuiltInEvidenceHelper.idPermissionRequestEvidence:
                {
                    IBuiltInEvidence pre = new PermissionRequestEvidence();
                    position = pre.InitFromBuffer(buffer, position);
                    AddHost(pre);
                    break;
                }

                case BuiltInEvidenceHelper.idGac:
                {
                    IBuiltInEvidence g = new GacInstalled();
                    position = g.InitFromBuffer(buffer, position);
                    AddHost(g);
                    break;
                }

                default:
                    throw new SerializationException(Environment.GetResourceString("Serialization_UnableToFixup"));
                } // switch
            }     // while
        }
Esempio n. 13
0
		public void ToString_ ()
		{
			GacInstalled gac = new GacInstalled ();
			Assert.IsTrue (gac.ToString ().StartsWith ("<System.Security.Policy.GacInstalled version=\"1\"/>"));
		}
Esempio n. 14
0
		public void GetHashCode_ ()
		{
			GacInstalled gac = new GacInstalled ();
			Assert.AreEqual (0, gac.GetHashCode ());
		}
Esempio n. 15
0
		public void Constructor () 
		{
			GacInstalled gac = new GacInstalled ();
			Assert.IsNotNull (gac);
		}
Esempio n. 16
0
		public void GacInstalled_OutputToBuffer_OutOfRange ()
		{
			char[] buffer = new char [1] { '\t' };
			GacInstalled g = new GacInstalled ();
			OutputToBuffer (g, buffer, 1, false);
		}
Esempio n. 17
0
		public void GacInstalled_GetRequiredSize ()
		{
			GacInstalled g = new GacInstalled ();
			Assert.AreEqual (1, GetRequiredSize (g, true), "GetRequiredSize-true");
			Assert.AreEqual (1, GetRequiredSize (g, false), "GetRequiredSize-false");
		}
Esempio n. 18
0
 internal Evidence(char[] buffer)
 {
     int position = 0;
     while (position < buffer.Length)
     {
         switch (buffer[position++])
         {
             case BuiltInEvidenceHelper.idApplicationDirectory:
             {
                 IBuiltInEvidence ad = new ApplicationDirectory();
                 position = ad.InitFromBuffer(buffer, position);
                 AddAssembly(ad);
                 break;
             }
             case BuiltInEvidenceHelper.idStrongName:
             {
                 IBuiltInEvidence sn = new StrongName();
                 position = sn.InitFromBuffer(buffer, position);
                 AddHost(sn);
                 break;
             }
             case BuiltInEvidenceHelper.idZone:
             {
                 IBuiltInEvidence z = new Zone();
                 position = z.InitFromBuffer(buffer, position);
                 AddHost(z);
                 break;
             }
             case BuiltInEvidenceHelper.idUrl:
             {
                 IBuiltInEvidence u = new Url();
                 position = u.InitFromBuffer(buffer, position);
                 AddHost(u);
                 break;
             }
             case BuiltInEvidenceHelper.idSite:
             {
                 IBuiltInEvidence s = new Site();
                 position = s.InitFromBuffer(buffer, position);
                 AddHost(s);
                 break;
             }
             case BuiltInEvidenceHelper.idPermissionRequestEvidence:
             {
                 IBuiltInEvidence pre = new PermissionRequestEvidence();
                 position = pre.InitFromBuffer(buffer, position);
                 AddHost(pre);
                 break;
             }
             case BuiltInEvidenceHelper.idGac:
             {
                 IBuiltInEvidence g = new GacInstalled();
                 position = g.InitFromBuffer(buffer, position);
                 AddHost(g);
                 break;
             }
             default:
                 throw new SerializationException(Environment.GetResourceString("Serialization_UnableToFixup"));
         } // switch
     } // while
 }