public void createHelloWorld()
        {
            string testFile = new CreateTestExe().createBasicHelloWorldExe(true).save();

            Assert.IsTrue(File.Exists(testFile), "File was not created");
            List <MethodDefinition> typeDefinitions = CecilUtils.getMethods(testFile);

            Assert.IsTrue(typeDefinitions.Count > 0, "no typeDefinitions in file created");
            List <string> modules = StringsAndLists.getStringListFromList(CecilUtils.getModules(testFile));
            List <string> types   = StringsAndLists.getStringListFromList(CecilUtils.getMethods(testFile));
            List <string> methods = StringsAndLists.getStringListFromList(CecilUtils.getTypes(testFile));

            Assert.IsTrue(modules.Count > 0, "no modules in file created");
            Assert.IsTrue(types.Count > 0, "no types in file created");
            Assert.IsTrue(methods.Count > 0, "no methods in file created");
            Assert.IsTrue(modules[0].IndexOf("main") > 0, "main module");
            Assert.IsTrue(types[0] == "System.Void BasicTest.Program::Main()", "Main Type");
            Assert.IsTrue(methods[0] == "<Module>", "Module Method");
            Assert.IsTrue(methods[1] == "BasicTest.Program", "Program Method");

            List <string> methodsCalled = StringsAndLists.getStringListFromList(CecilUtils.getMethodsCalledInsideAssembly(testFile));

            Assert.IsTrue(methodsCalled.Count > 0, "no methodsCalled");
            Assert.IsTrue(methodsCalled[0] == "System.Void System.Console::WriteLine(System.String)", "WriteLine #1");
            Assert.IsTrue(methodsCalled[1] == "System.Void System.Console::WriteLine(System.String)", "WriteLine #2");
            Assert.IsTrue(methodsCalled[2] == "System.String System.Console::ReadLine()", "ReadLine #1");
        }
        public void decompileMainModule()
        {
            string sourceCodeFile = DI.config.TempFileNameInTempDirectory + ".cs";
            string testExe        = new CreateTestExe().createBasicHelloWorldExe().save();

            Assert.IsTrue(File.Exists(testExe), "Test script was not created");
            string sourceCode = new CecilDecompiler().getSourceCode(testExe);

            Assert.IsNotEmpty(sourceCode, "main module source code was empty");
            Files.WriteFileContent(sourceCodeFile, sourceCode);
            Assert.IsTrue(File.Exists(sourceCodeFile), "Source code was not created");
        }
        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");
        }
        public void createBasicHelloWorldExeTest()
        {
            var sResponse = new CreateTestExe().createBasicHelloWorldExe().save();

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