public void Intersect_Different()
        {
            UrlIdentityPermission uip1   = new UrlIdentityPermission(GoodUrls [0]);
            UrlIdentityPermission uip2   = new UrlIdentityPermission(GoodUrls [1]);
            UrlIdentityPermission result = (UrlIdentityPermission)uip1.Intersect(uip2);

            Assert.IsNull(result, "Mono N Novell");
        }
        public void Intersect_None()
        {
            UrlIdentityPermission uip1   = new UrlIdentityPermission(PermissionState.None);
            UrlIdentityPermission uip2   = new UrlIdentityPermission(PermissionState.None);
            UrlIdentityPermission result = (UrlIdentityPermission)uip1.Intersect(uip2);

            Assert.IsNull(result, "None N None");
            foreach (string s in GoodUrls)
            {
                uip1.Url = s;
                // 1. Intersect None with Url
                result = (UrlIdentityPermission)uip1.Intersect(uip2);
                Assert.IsNull(result, "None N " + s);
                // 2. Intersect Url with None
                result = (UrlIdentityPermission)uip2.Intersect(uip1);
                Assert.IsNull(result, s + "N None");
            }
        }
        public void Intersect_Null()
        {
            UrlIdentityPermission uip = new UrlIdentityPermission(PermissionState.None);

            // No intersection with null
            foreach (string s in GoodUrls)
            {
                uip.Url = s;
                Assert.IsNull(uip.Intersect(null), s);
            }
        }
        public void Intersect_Self()
        {
            UrlIdentityPermission uip = new UrlIdentityPermission(PermissionState.None);

            foreach (string s in GoodUrls)
            {
                uip.Url = s;
                UrlIdentityPermission result = (UrlIdentityPermission)uip.Intersect(uip);
                // Fx 1.0/1.1 adds a '/' at the end, while 2.0 keeps the original format
                // so we only compare the start of the url
                Assert.IsTrue(result.Url.StartsWith(uip.Url), s);
            }
        }
Exemplo n.º 5
0
        public static void UrlIdentityPermissionCallMethods()
        {
            UrlIdentityPermission uip  = new UrlIdentityPermission(new PermissionState());
            UrlIdentityPermission uip2 = new UrlIdentityPermission("testsite");
            IPermission           ip   = uip.Copy();
            IPermission           ip2  = uip.Intersect(ip);
            bool testbool = uip.IsSubsetOf(ip);

            ip2 = uip.Union(ip);
            SecurityElement se = new SecurityElement("");

            uip.FromXml(se);
            se = uip.ToXml();
        }
Exemplo n.º 6
0
    // </Snippet3>
    // <Snippet4>
    // Intersect creates and returns a new permission that is the intersection of the
    // current permission and the permission specified.
    private static void IntersectDemo()
    {
        UrlIdentityPermission permIdPerm1 = new UrlIdentityPermission("http://www.fourthcoffee.com/process/");
        UrlIdentityPermission permIdPerm2 = new UrlIdentityPermission("http://www.fourthcoffee.com/*");
        UrlIdentityPermission p3          = (UrlIdentityPermission)permIdPerm1.Intersect(permIdPerm2);

        if (p3 != null)
        {
            Console.WriteLine("The intersection of " + permIdPerm1.Url + " and \n\t" +
                              permIdPerm2.Url + " is " + p3.Url + "\n");
        }
        else
        {
            Console.WriteLine("The intersection of " + permIdPerm1.Url +
                              " and \n\t" + permIdPerm2.Url + " is null.\n");
        }
    }
Exemplo n.º 7
0
 public static void UrlIdentityPermissionCallMethods()
 {
     UrlIdentityPermission uip = new UrlIdentityPermission(new PermissionState());
     UrlIdentityPermission uip2 = new UrlIdentityPermission("testsite");
     IPermission ip = uip.Copy();
     IPermission ip2 = uip.Intersect(ip);
     bool testbool = uip.IsSubsetOf(ip);
     ip2 = uip.Union(ip);
     SecurityElement se = new SecurityElement("");
     uip.FromXml(se);
     se = uip.ToXml();
 }