Inheritance: Xunit.LongLivedMarshalByRefObject
Example #1
0
        public DiaSessionWrapper(string assemblyFilename)
        {
            session = new DiaSession(assemblyFilename);

            var setup = new AppDomainSetup
            {
                ApplicationBase = Path.GetDirectoryName(new Uri(typeof(DiaSessionWrapperHelper).Assembly.CodeBase).LocalPath),
                ApplicationName = Guid.NewGuid().ToString(),
                LoaderOptimization = LoaderOptimization.MultiDomainHost,
                ShadowCopyFiles = "true",
            };

            setup.ShadowCopyDirectories = setup.ApplicationBase;
            setup.CachePath = Path.Combine(Path.GetTempPath(), setup.ApplicationName);

            appDomain = AppDomain.CreateDomain(setup.ApplicationName, null, setup, new PermissionSet(PermissionState.Unrestricted));

            helper = (DiaSessionWrapperHelper)appDomain.CreateInstanceAndUnwrap(
                assemblyName: typeof(DiaSessionWrapperHelper).Assembly.FullName,
                typeName: typeof(DiaSessionWrapperHelper).FullName,
                ignoreCase: false,
                bindingAttr: 0,
                binder: null,
                args: new[] { assemblyFilename },
                culture: null,
                activationAttributes: null,
                securityAttributes: null
            );
        }
        public DiaSessionWrapper(string assemblyFilename)
        {
            session = new DiaSession(assemblyFilename);

            var assemblyFileName = typeof(DiaSessionWrapperHelper).Assembly.GetLocalCodeBase();

            appDomainManager = new AppDomainManager_AppDomain(assemblyFileName, null, true, null);
            helper = appDomainManager.CreateObject<DiaSessionWrapperHelper>(typeof(DiaSessionWrapperHelper).Assembly.GetName(), typeof(DiaSessionWrapperHelper).FullName, assemblyFilename);
        }
Example #3
0
        public DiaSessionWrapper(string assemblyFilename)
        {
            session = new DiaSession(assemblyFilename);

            var assemblyFileName = new Uri(typeof(DiaSessionWrapperHelper).Assembly.CodeBase).LocalPath;

            appDomainManager = new RemoteAppDomainManager(assemblyFileName, null, true);
            helper = appDomainManager.CreateObject<DiaSessionWrapperHelper>(typeof(DiaSessionWrapperHelper).Assembly.FullName, typeof(DiaSessionWrapperHelper).FullName, assemblyFilename);
        }
Example #4
0
        public DiaSessionWrapper(string assemblyFilename, bool shadowCopy = true, string configFileName = null)
        {
            session = new DiaSession(assemblyFilename);

            string xUnitAssemblyPath = typeof(DiaSessionWrapperHelper).Assembly.GetLocalCodeBase();
            string xUnitAssemblyDirectory = Path.GetDirectoryName(xUnitAssemblyPath);

            appDomainManager = new RemoteAppDomainManager(assemblyFilename, configFileName, shadowCopy, null);

            // We want to be able to create the wrapper in the other domain, yet keep the domain centered on the test assembly.
            helper = appDomainManager.CreateObjectFromPath<DiaSessionWrapperHelper>(xUnitAssemblyPath, typeof(DiaSessionWrapperHelper).FullName, assemblyFilename, xUnitAssemblyDirectory);
        }
Example #5
0
        public DiaSessionWrapper(string assemblyFilename)
        {
            session = new DiaSession(assemblyFilename);

            helper = new DiaSessionWrapperHelper(assemblyFilename);
        }
        public DiaSessionWrapper(string assemblyFilename)
        {
            session = new DiaSession(assemblyFilename);

            helper = new DiaSessionWrapperHelper(assemblyFilename);
        }