コード例 #1
0
ファイル: Program.cs プロジェクト: jamarchist/SharpMock
        static void Main(string[] args)
        {
            var postCompilerArgs = new PostCompilerArgs(args);
            var postCompiler = new SharpMock.Core.PostCompiler.PostCompiler(postCompilerArgs, new ConsoleLogger());

            postCompiler.InterceptSpecifications();
            postCompiler.InterceptAllStaticMethodCalls();

            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
コード例 #2
0
ファイル: PostCompiler.cs プロジェクト: jamarchist/SharpMock
        public PostCompiler(PostCompilerArgs postCompilerArgs, ILogger log)
        {
            this.log = log;

            if (postCompilerArgs.AreValid())
            {
                var nameTable = new NameTable();
                host = new PeReader.DefaultHost(nameTable);

                sharpMockCore = host.LoadUnitFrom(
                            System.Reflection.Assembly.GetExecutingAssembly().Location
                        );
                sharpMockDelegateTypes = sharpMockCore as IAssembly;

                host.Errors += host_Errors;
            }

            this.postCompilerArgs = postCompilerArgs;

            #if DEBUG && LAUNCH_DEBUGGER
            System.Diagnostics.Debugger.Launch();
            #endif
        }