Exemplo n.º 1
0
        public Evaluation Evaluate(string workingDirectory, string shortFileName, string fullReflectionFile, string fullUnitTestingFile)
        {
            var dllFileFullName = Path.Combine(workingDirectory, shortFileName);

            dllFileFullName = UtilHelper.ChangeVirtualExtension(dllFileFullName, ".dll");

            var buildInfo = BuildAndScan(workingDirectory, dllFileFullName, fullUnitTestingFile);

            if (!buildInfo.Succes)
            {
                return(new Evaluation(buildInfo.Info));
            }

            if (!ScanForViruses(UtilHelper.RemoveVirtualExtension(shortFileName)))
            {
                return(new Evaluation("dll file contains viruses"));
            }

            byte[] assemblyBytes = File.ReadAllBytes(dllFileFullName);
            var    assembly      = Assembly.Load(assemblyBytes);

            //----static evaluation -----//

            var staticEvaluation = RunStaticEvaluation(assembly, fullReflectionFile);

            //----functional evaluation -----//

            var functionalEvaluation = RunFunctionalEvaluation(assembly, workingDirectory, dllFileFullName);

            return(new Evaluation(staticEvaluation, functionalEvaluation));
        }