public void injectHooksTest_onO2Module()
        {
            String sO2ModuleToTest = @"E:\O2\_Bin_(O2_Binaries)\O2_Tool_CSharpScripts.exe";

            String sTargetFolder = Path.Combine(DI.config.O2TempDir,
                                                Path.GetFileNameWithoutExtension(sO2ModuleToTest));

            if (Directory.Exists(sTargetFolder))
            {
                Files.deleteFolder(sTargetFolder, true);
            }
            Files.copyFilesFromDirectoryToDirectory(Path.GetDirectoryName(sO2ModuleToTest), sTargetFolder);

            String sO2ModuleToTestInTempDirectory = Path.Combine(sTargetFolder, Path.GetFileName(sO2ModuleToTest));

            // move required dlls
            String sAspectDngExe = DngConfig.extractAspectDngExeToTempFolder();
            String sHooksDll     = DngConfig.copyCurrentDllToTempFolder();

            File.Copy(sAspectDngExe, Path.Combine(sTargetFolder, Path.GetFileName(sAspectDngExe)));
            File.Copy(sHooksDll, Path.Combine(sTargetFolder, Path.GetFileName(sHooksDll)));

            //dlls to hook
            if (true)
            {
                var lsDllsToHook = new List <String>();
                lsDllsToHook.Add("O2_Kernel.dll");
                lsDllsToHook.Add("O2_Views_ASCX.dll");

                foreach (String sDll in lsDllsToHook)
                {
                    String sDllToHook = Path.Combine(sTargetFolder, sDll);
                    Assert.IsTrue(File.Exists(sDllToHook), "Copy failed for : " + sDllToHook);
                    String sResult = DngUtils.injectHooks(sDllToHook, "* System.IO.*", "*");
                }
            }
            Debug.WriteLine("sO2ModuleToTestInTempDirectory");
            Debug.WriteLine(sO2ModuleToTestInTempDirectory);
            Assert.IsTrue(sO2ModuleToTestInTempDirectory.IndexOf(".exe") > -1, "no exe to execute");
            Processes.startProcess(sO2ModuleToTestInTempDirectory, "");

            // Assert.IsTrue(File.Exists(sO2ModuleToTestInTempDirectory), "Hooked Does not exist: {0}", sO2ModuleToTestInTempDirectory);

            /*string sTargetAssembly = (String)SpringCore.createTypeAndInvokeMethod(typeof(o2.MonoCecil.CreateTestExes), "createBasicHelloWorldExe");
             * Assert.IsTrue(File.Exists(sTargetAssembly), "Target Assembly Does not exist: {0}", sTargetAssembly);
             *
             * String sResult = DngUtils.injectHooks(sTargetAssembly);
             *
             * Assert.IsTrue(File.Exists(sTargetAssembly), "New Assembly Does not exist: {0}", sTargetAssembly);
             */
        }
        public void injectHooksTest()
        {
            String sHooksDll = DngConfig.copyCurrentDllToTempFolder();

            Assert.IsTrue("" != CecilUtils.getAttributeValueFromAssembly(sHooksDll, "AroundBody", 0).ToString(),
                          "Finding AroundBody");
            String sNewParameterValue = "*AAAAA*";

            Assert.IsTrue(CecilUtils.setAttributeValueFromAssembly(sHooksDll, "AroundBody", 0, sNewParameterValue),
                          "setting attribute");
            Assert.IsTrue(
                sNewParameterValue == CecilUtils.getAttributeValueFromAssembly(sHooksDll, "AroundBody", 0).ToString(),
                "Checking for persistance of changed data");

            var sTargetAssembly = new CreateTestExe().createBasicHelloWorldExe().save();
            //SpringExec.createTypeAndInvokeMethod(typeof (CreateTestExesTest), "createBasicHelloWorldExe");

            String sHookInjectionResult    = DngUtils.injectHooks(sTargetAssembly, "*", "*");
            String sProcessExecutionResult = Processes.startProcessAsConsoleApplicationAndReturnConsoleOutput(sTargetAssembly, "");


            //Assert.IsTrue(File.Exists(sTargetAssembly), "New Assembly Does not exist: {0}", sTargetAssembly);
            DI.log.info("Test Completed");
        }