예제 #1
0
        public void MakeStructParamsCall()
        {
            IStateName2 proxy = (IStateName2)XmlRpcProxyGen.Create(typeof(IStateName2));
            string      ret   = proxy.GetStateNames(1, 2, 3);

            Assert.AreEqual("Alabama Alaska Arizona", ret);
        }
예제 #2
0
        public void FileIOPermission()
        {
            FileIOPermission f = new FileIOPermission(PermissionState.Unrestricted);

            f.Deny();
            try
            {
                IStateName2 proxy = (IStateName2)XmlRpcProxyGen.Create(typeof(IStateName2));
            }
            finally
            {
                CodeAccessPermission.RevertDeny();
            }
        }
예제 #3
0
        public void FileIOPermission()
        {
            PermissionSet ps = new PermissionSet(PermissionState.None);

            ps.AddPermission(new SecurityPermission(SecurityPermissionFlag.Execution));
            //Create a new sandboxed domain
            AppDomainSetup setup     = AppDomain.CurrentDomain.SetupInformation;
            AppDomain      newDomain = AppDomain.CreateDomain("test domain", null, setup, ps);


            //Create an instance in the new domain.
            //The class has to derive from MarshalByRefObject. We consider
            //PartialTrustTest to be such a class
            var remoteTest = newDomain.CreateInstanceAndUnwrap(
                typeof(SandBox).Assembly.FullName,
                typeof(SandBox).FullName) as SandBox;
            IStateName2 proxy = remoteTest.GetProxy();
        }