示例#1
0
        /// <summary>
        /// Runs method generated by the specified director.
        /// </summary>
        /// <param name="director">The director that emits method's instructions.</param>
        /// <returns>Result of test analysis that can be tested by assertions.</returns>
        internal static TestResult Run(EmitDirector director)
        {
            var assembly = SettingsProvider.CreateTestingAssembly();

            var machine = SettingsProvider.CreateMachine(assembly.Settings);

            assembly.Runtime.BuildAssembly();
            var loader = new EmitDirectorLoader(director, assembly.Loader);

            return(new TestResult(machine.Run(loader, loader.EntryPoint)));
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestingAssembly" /> class.
        /// </summary>
        /// <param name="settings">The settings.</param>
        public TestingAssembly(MachineSettings settings)
        {
            Settings = settings;
            Runtime  = settings.Runtime;
            Machine  = SettingsProvider.CreateMachine(Settings);

            Loader = new AssemblyLoader(Settings, _factory);

            //load self
            _factory.Register(this, this);
            Loader.AppDomain.Transactions.StartNew("Test");
            Loader.LoadRoot(this);
        }