Exemplo n.º 1
0
        public void Test_getMemberFunction(CirData cirData, TypeDefinition testType, string methodToTest,
                                           Type[] methodParameters)
        {
            MethodDefinition cecilMethodDefinition = CecilUtils.getMethod(testType, methodToTest, methodParameters);

            Assert.IsNotNull(cecilMethodDefinition, "cecilMethodDefinition was null for method", methodToTest);
            ICirFunction cirFunction = cirFactory.processMethodDefinition(cirData, cecilMethodDefinition, null);

            Assert.IsNotNull(cirFunction, "cecilMethodDefinition was null for method", cecilMethodDefinition);
            Assert.That(CirCecilCompare.areEqual_MethodDefinitionAndCirFunction(cecilMethodDefinition, cirFunction),
                        "areEqual_MethodDefinitionAndCirFunction failed for method: " + cecilMethodDefinition);
        }
Exemplo n.º 2
0
        public void checkThatAllFunctionsMatch(ICirData cirData, AssemblyDefinition testAssembly)
        {
            //var assertChecks = true;
            foreach (MethodDefinition methodDefinition in CecilUtils.getMethods(testAssembly))
            {
                string functionSignature =
                    CirFactoryUtils.getFunctionUniqueSignatureFromMethodReference(methodDefinition);

                //if (assertChecks)
                //{
                Assert.That(cirData.dFunctions_bySignature.ContainsKey(functionSignature),
                            "Could not find functionSignature in cirData object: " + functionSignature);
                //}

                /*else if (cirData.dFunctions_bySignature.ContainsKey(functionSignature) == false)
                 * {
                 *  var BaseClass = methodDefinition.DeclaringType.FullName;
                 *
                 *  DI.log.error("    ****       Could not find functionSignature in cirData object: " +
                 *               functionSignature);
                 *  return;
                 * }*/


                ICirFunction cirFunction = cirData.dFunctions_bySignature[functionSignature];

                //if (assertChecks)
                {
                    Assert.That(CirCecilCompare.areEqual_MethodDefinitionAndCirFunction(methodDefinition, cirFunction),
                                "Function's didn't match: " + functionSignature);
                }

                /*else if (CirCecilCompare.areEqual_MethodDefinitionAndCirFunction(methodDefinition, cirFunction) == false)
                 * {
                 *  DI.log.error("    ****   Function's didn't match: " + functionSignature + "   for   " +
                 *               testAssembly.Name);
                 * }*/


                //
            }
        }