예제 #1
0
파일: Runner.cs 프로젝트: MarMar/SeeFlaw
 public void ThreadRun()
 {
     resultData = RunFixtureMethodCall(runNode);
 }
예제 #2
0
파일: Runner.cs 프로젝트: MarMar/SeeFlaw
 public void RunFixtureCaughtException()
 {
     ResultHolder dataHolder = new ResultHolder("Testing exception", null, false);
     dataHolder.AddSingleRow(null, null, null, new Exception("Exception message"));
     XmlNode resultNode = parser.GetResultAsXml(dataHolder);
     System.Console.WriteLine(resultNode.OuterXml);
     XmlNode htmlNode = HtmlTransformer.ConvertToHtml(resultNode.OwnerDocument, resultNode);
     string expected = "<table border=\"0\" cellpadding=\"0\" class=\"step_error\"><tr><td><table width=\"100%\">";
     expected += "<tr><th align=\"left\" bgcolor=\"#FF5555\" class=\"title\">Testing exception</th></tr></table></td></tr>";
     expected += "<tr><td><table border=\"1\" cellpadding=\"3\" cellspacing=\"0\" width=\"100%\">";
     expected += "<tr><td class=\"status_error\">Type</td><td class=\"time_value\">Time</td></tr>";
     expected += "<tr><td bgcolor=\"#FF0000\" class=\"statusvalue_error\"><a href=\"#Exception1\">Exception1</a></td><td class=\"time_value\">(00:00:00)</td></tr>";
     expected += "</table></td></tr></table>";
     System.Console.WriteLine(htmlNode.OuterXml);
     NUnit.Framework.Assert.AreEqual(expected, htmlNode.OuterXml);
 }
예제 #3
0
파일: Runner.cs 프로젝트: MarMar/SeeFlaw
        public ResultHolder RunFixtureParam(List<XmlNode> paramNodes)
        {
            ResultHolder dataHolder = new ResultHolder("param", true);
            foreach (XmlNode paramNode in paramNodes)
            {
                try
                {
                    Exception fixEx = null;
                    XmlAttribute name = SeeFlaw.GetAttributeByName(paramNode, "name");
                    Dictionary<string, string> inputDic = new Dictionary<string, string>();
                    Dictionary<string, string> outputDic = new Dictionary<string, string>();
                    Dictionary<string, object> resultDic = new Dictionary<string, object>();
                    inputDic.Add("name", name.Value);
                    XmlAttribute valAttr = SeeFlaw.GetAttributeByName(paramNode, "value", true);
                    XmlAttribute argAttr = SeeFlaw.GetAttributeByName(paramNode, "argument", true);
                    if (valAttr == null && argAttr == null)
                    {
                        fixEx = new Exception("argument and value attributes missing in param node");
                    }
                    string paramValue = "";
                    if (valAttr != null)
                    {
                        paramValue = valAttr.Value;
                        inputDic.Add("value", valAttr.Value);
                    }
                    if (argAttr != null)
                    {
                        string val = runDetails.GetArgument(argAttr.Value);
                        if (val != "")
                        {
                            paramValue = val;
                            inputDic.Add("argument", argAttr.Value);
                            outputDic.Add("read_value", "");
                            resultDic.Add("read_value", val);
                        }
                        else if (valAttr == null)
                        {
                            throw new Exception("Argument " + argAttr.Value + " in param node is missing in argument list");
                        }
                    }
                    if (!resultDic.ContainsKey("read_value"))
                    {
                        resultDic.Add("read_value", "");
                    }
                    runDetails.AddParameter(name.Value, paramValue);
                    dataHolder.AddSingleRow(inputDic, outputDic, resultDic, fixEx);

                }
                catch (Exception ex)
                {
                    dataHolder.AddSingleRow(null, null, null, ex);
                }
            }

            return dataHolder;
        }
예제 #4
0
파일: Runner.cs 프로젝트: MarMar/SeeFlaw
        public ResultHolder RunFixtureParam(XmlNode callNode, Object callFixture, string fixtureName)
        {
            activeDataHolder = null;
            string fixtureMethod = "";
            try
            {
                XmlAttribute name = SeeFlaw.GetAttributeByName(callNode, "name");
                XmlAttribute methodAttr = SeeFlaw.GetAttributeByName(callNode, "method");
                fixtureMethod = methodAttr.Value;
                activeDataHolder = new ResultHolder("param", fixtureName, fixtureMethod, name.Value, false);
                MethodInfo methodInfo = callFixture.GetType().GetMethod(methodAttr.Value);
                string inputType = CheckMethodInfo(methodInfo);

                ParameterInfo[] infos = methodInfo.GetParameters();
                if (infos.Length > 1)
                {
                    throw new Exception("To many arguments in method");
                }

                Dictionary<string, string> inputDic = new Dictionary<string, string>();
                Dictionary<string, string> outputDic = new Dictionary<string, string>();
                Dictionary<string, object> resultDic = new Dictionary<string, object>();
                Object[] attributes = new Object[] { };
                string paramValue = "";
                if (infos.Length == 1)
                {
                    XmlNode paramFixtureInputNode = HtmlTransformer.GetChildNodeByName(callNode, "input");
                    InputArguments inputArgs = ReadArgumentsFromNode(paramFixtureInputNode, inputType);
                    inputDic = inputArgs.visibleArgDic;
                    attributes = new Object[] { inputArgs.attribute };
                }
                paramValue = (string)methodInfo.Invoke(callFixture, attributes);
                outputDic.Add("read_value", "");
                resultDic.Add("read_value", paramValue);
                runDetails.AddParameter(name.Value, paramValue);
                activeDataHolder.AddSingleRow(inputDic, outputDic, resultDic, null);
            }
            catch (Exception ex)
            {
                activeDataHolder = new ResultHolder(fixtureName, fixtureMethod, null, true);
                activeDataHolder.AddSingleRow(null, null, null, ex);
            }
            return activeDataHolder;
        }
예제 #5
0
파일: Runner.cs 프로젝트: MarMar/SeeFlaw
        public ResultHolder RunFixtureInit(List<XmlNode> initNodes)
        {
            ResultHolder dataHolder = new ResultHolder("init", true);
            foreach (XmlNode initNode in initNodes)
            {
                try
                {
                    Exception fixEx = null;

                    XmlAttribute fixture = SeeFlaw.GetAttributeByName(initNode, "fixture");
                    XmlAttribute idNode = SeeFlaw.GetAttributeByName(initNode, "id");
                    Object fixtureObj = runDetails.InitFixture(fixture.Value, idNode.Value);

                    Dictionary<string, string> initDic = new Dictionary<string, string>();
                    initDic.Add("fixture", fixture.Value);
                    initDic.Add("id", idNode.Value);
                    dataHolder.AddSingleRow(initDic, null, null, fixEx);
                }
                catch (Exception ex)
                {
                    dataHolder.AddSingleRow(null, null, null, ex);
                }
            }

            return dataHolder;
        }
예제 #6
0
파일: Runner.cs 프로젝트: MarMar/SeeFlaw
 public ResultHolder RunFixtureMethodCall(XmlNode callNode, Object callFixture, string fixtureName)
 {
     activeDataHolder = null;
     Dictionary<string, string> toleranceDic = ReadToleranceFromNode(callNode);
     string fixtureMethod = "";
     try
     {
         XmlAttribute methodAttr = SeeFlaw.GetAttributeByName(callNode, "method");
         fixtureMethod = methodAttr.Value;
         activeDataHolder = new ResultHolder(fixtureName, fixtureMethod, toleranceDic, false);
         MethodInfo methodInfo = callFixture.GetType().GetMethod(methodAttr.Value);
         string inputType = CheckMethodInfo(methodInfo);
         if (methodInfo.ReturnType == typeof(void))
         {
             bool calledWithInput = false;
             foreach (XmlNode childNode in callNode)
             {
                 if (childNode.LocalName == "input")
                 {
                     calledWithInput = true;
                     InputArguments inputArgs = ReadArgumentsFromNode(childNode, inputType);
                     activeDataHolder.CreateSingleRow(inputArgs.visibleArgDic, null);
                     Object[] attributes = PopulateAttributes(methodInfo, inputArgs, null);
                     try
                     {
                         methodInfo.Invoke(callFixture, attributes);
                         activeDataHolder.SetSingleRowResult(null, null);
                     }
                     catch (Exception ex)
                     {
                         activeDataHolder.SetSingleRowResult(null, ex);
                     }
                 }
             }
             if (!calledWithInput)
             {
                 activeDataHolder.CreateSingleRow(null, null);
                 Object[] attributes = new Object[]{};
                 try
                 {
                     methodInfo.Invoke(callFixture, attributes);
                     activeDataHolder.SetSingleRowResult(null, null);
                 }
                 catch (Exception ex)
                 {
                     activeDataHolder.SetSingleRowResult(null, ex);
                 }
             }
         }
         else if (methodInfo.ReturnType == typeof(Dictionary<string, object>))
         {
             InputArguments inputArgs = null;
             Dictionary<string, string> outputDic = null;
             foreach (XmlNode childNode in callNode)
             {
                 if (childNode.LocalName == "input")
                 {
                     inputArgs = ReadArgumentsFromNode(childNode, inputType);
                 }
                 else if (childNode.LocalName == "output")
                 {
                     outputDic = ReadDicFromNode(childNode, InputType.DIC);
                     activeDataHolder.CreateSingleRow(inputArgs.visibleArgDic, outputDic);
                     Object[] attributes = PopulateAttributes(methodInfo, inputArgs, outputDic.Keys.ToList());
                     try
                     {
                         Dictionary<string, object> result = (Dictionary<string, object>)methodInfo.Invoke(callFixture, attributes);
                         activeDataHolder.SetSingleRowResult(result, null);
                     }
                     catch (Exception ex)
                     {
                         if (ex.InnerException != null)
                         {
                             System.Console.WriteLine(ex.InnerException.Message);
                         }
                         activeDataHolder.SetSingleRowResult(null, ex);
                     }
                 }
             }
         }
         else if (methodInfo.ReturnType == typeof(List<Dictionary<string, object>>))
         {
             InputArguments inputArgs = ReadArguments(callNode, inputType);
             List<Dictionary<string, string>> outputList = ReadOutputList(callNode, runDetails);
             if (outputList.Count == 0)
             {
                 List<string> outputKeys = ReadOutputKeys(callNode);
                 bool allowSurplus = false;
                 if (SeeFlaw.GetAttributeByName(callNode, "allowsurplus", true) != null)
                 {
                     allowSurplus = true;
                 }
                 activeDataHolder.CreateMultiRows(inputArgs.visibleArgDic, outputKeys, allowSurplus);
             }
             else
             {
                 activeDataHolder.CreateMultiRows(inputArgs.visibleArgDic, outputList);
             }
             Object[] attributes = PopulateAttributes(methodInfo, inputArgs, activeDataHolder.multiRowKeys);
             try
             {
                 List<Dictionary<string, object>> result = (List<Dictionary<string, object>>)methodInfo.Invoke(callFixture, attributes);
                 activeDataHolder.SetMultiRowsResult(result, null);
             }
             catch (Exception ex)
             {
                 activeDataHolder.SetMultiRowsResult(null, ex);
             }
         }
         else
         {
             throw new Exception("fixture method return type not supported");
         }
     }
     catch (Exception ex)
     {
         activeDataHolder = new ResultHolder(fixtureName, fixtureMethod, null, true);
         activeDataHolder.AddSingleRow(null, null, null, ex);
     }
     return activeDataHolder;
 }
예제 #7
0
 public XmlNode GetResultAsXml(ResultHolder dataHolder)
 {
     if (dataHolder == null)
     {
         return null;
     }
     Result result = new Result();
     List<XmlNode> rowNodes = null;
     XmlElement multiRowTable = null;
     string methodType = "";
     if (dataHolder.multiRows != null)
     {
         methodType = "multi";
         {
             multiRowTable = BuildMultiRowNode(dataHolder, result);
         }
     }
     else
     {
         methodType = "single";
         rowNodes = BuildRowNode(dataHolder, result);
     }
     XmlElement callNode = BuildHeadNode(dataHolder, result, methodType);
     if (rowNodes != null)
     {
         foreach (XmlNode rowNode in rowNodes)
         {
             callNode.AppendChild(rowNode);
         }
     }
     if (multiRowTable != null)
     {
         callNode.AppendChild(multiRowTable);
     }
     if (!result.passed)
     {
         dataHolder.TestFailed();
     }
     return callNode;
 }
예제 #8
0
 public string GetTolerance(string key, ResultHolder dataHolder)
 {
     string within = "";
     if (dataHolder.toleranceDic != null)
     {
         dataHolder.toleranceDic.TryGetValue(key, out within);
     }
     return within;
 }
예제 #9
0
        public XmlElement BuildMultiRowNode(ResultHolder dataHolder, Result result)
        {
            XmlElement resultNode = doc.CreateElement("result");

            ResultHolder.RowResult rowResult = dataHolder.singleRows[0];
            if (rowResult != null)
            {
                if (!dataHolder.skipTime)
                {
                    resultNode.SetAttribute("time", GetTimeString(rowResult.partTime));
                }

                XmlElement rowInputNode = doc.CreateElement("input");
                resultNode.AppendChild(rowInputNode);
                foreach (string inputKey in dataHolder.inputKeys)
                {
                    string input = GetInputData(inputKey, rowResult.inputDic);
                    rowInputNode.SetAttribute(inputKey, input);
                }
                if (rowResult.fixException != null)
                {
                    resultNode.SetAttribute("status", ResultType.UNPROCESSED);
                    resultNode.AppendChild(errorParser.AddXmlError(doc, rowResult.fixException));
                    result.Error();

                    foreach (Dictionary<string, string> outputDic in dataHolder.multiRows.multiOutput)
                    {
                        XmlElement resultOutputNode = doc.CreateElement("output");
                        resultOutputNode.SetAttribute("status", ResultType.UNPROCESSED);
                        resultNode.AppendChild(resultOutputNode);

                        foreach (string outputKey in dataHolder.multiRowKeys)
                        {
                            XmlElement matchOutputNode = doc.CreateElement(outputKey);
                            resultOutputNode.AppendChild(matchOutputNode);
                            string outExpected = "";
                            outputDic.TryGetValue(outputKey, out outExpected);
                            matchOutputNode.SetAttribute("expected", outExpected);
                            matchOutputNode.SetAttribute("actual", "");
                            matchOutputNode.SetAttribute("status", ResultType.UNPROCESSED);
                        }
                    }
                }
            }

            if (dataHolder.multiRows.multiResult != null)
            {
                List<Dictionary<string, object>> matchedResults = MatchOutputToResult(dataHolder);
                int matchIndex = 0;
                foreach (Dictionary<string, string> outputDic in dataHolder.multiRows.multiOutput)
                {
                    Dictionary<string, object> resultDic = matchedResults[matchIndex];
                    XmlElement resultOutputNode = doc.CreateElement("output");

                    string partPassed = BuildMatchingData(resultOutputNode, outputDic, resultDic, dataHolder.multiRowKeys, dataHolder.toleranceDic);
                    if (partPassed != ResultType.PASS)
                    {
                        result.Fail();
                    }
                    resultOutputNode.SetAttribute("status", partPassed);
                    resultNode.AppendChild(resultOutputNode);
                    matchIndex++;
                }
                if (matchIndex < matchedResults.Count)
                {
                    if (!dataHolder.allowSurplus)
                    {
                        result.Fail();
                    }
                    while (matchIndex < matchedResults.Count)
                    {
                        Dictionary<string, object> surplusDic = matchedResults[matchIndex];
                        XmlElement surplusNode = doc.CreateElement("output");
                        surplusNode.SetAttribute("status", ResultType.SURPLUS);

                        foreach (string outputKey in dataHolder.multiRowKeys)
                        {
                            object value = null;
                            if (surplusDic.ContainsKey(outputKey))
                            {
                                surplusDic.TryGetValue(outputKey, out value);
                            }
                            XmlElement outputNode = doc.CreateElement(outputKey);
                            outputNode.SetAttribute("expected", "");
                            outputNode.SetAttribute("actual", GetObjStr(value));
                            outputNode.SetAttribute("status", ResultType.SURPLUS);
                            surplusNode.AppendChild(outputNode);
                        }
                        resultNode.AppendChild(surplusNode);
                        matchIndex++;
                    }
                }
            }
            resultNode.SetAttribute("status", result.type);
            return resultNode;
        }
예제 #10
0
        public List<XmlNode> BuildRowNode(ResultHolder dataHolder, Result result)
        {
            List<XmlNode> resultNodes = new List<XmlNode>();

            foreach (ResultHolder.RowResult rowResult in dataHolder.singleRows)
            {
                string partPassed = ResultType.PASS;
                XmlElement resultNode = doc.CreateElement("result");
                resultNode.SetAttribute("status", ResultType.PASS);
                if (!dataHolder.skipTime)
                {
                    resultNode.SetAttribute("time", GetTimeString(rowResult.partTime));
                }

                XmlElement rowInputNode = doc.CreateElement("input");
                resultNode.AppendChild(rowInputNode);
                foreach (string inputKey in dataHolder.inputKeys)
                {
                    string input = GetInputData(inputKey, rowResult.inputDic);
                    rowInputNode.SetAttribute(inputKey, input);
                }
                if (rowResult.fixException != null)
                {
                    resultNode.SetAttribute("status", ResultType.ERROR);
                    resultNode.AppendChild(errorParser.AddXmlError(doc, rowResult.fixException));
                    result.Error();

                    XmlElement rowOutputNode = doc.CreateElement("output");
                    resultNode.AppendChild(rowOutputNode);

                    foreach (string outputKey in dataHolder.outputKeys)
                    {
                        XmlElement matchOutputNode = doc.CreateElement(outputKey);
                        rowOutputNode.AppendChild(matchOutputNode);
                        string outExpected = "";
                        if (rowResult.outputDic != null)
                        {
                            rowResult.outputDic.TryGetValue(outputKey, out outExpected);
                        }
                        matchOutputNode.SetAttribute("expected", outExpected);
                        matchOutputNode.SetAttribute("actual", "");
                        matchOutputNode.SetAttribute("status", ResultType.UNPROCESSED);
                    }
                }
                else
                {
                    XmlElement rowOutputNode = doc.CreateElement("output");
                    resultNode.AppendChild(rowOutputNode);

                    partPassed = BuildMatchingData(rowOutputNode, rowResult.outputDic, rowResult.resultDic, dataHolder.outputKeys, dataHolder.toleranceDic);
                    if (partPassed != ResultType.PASS)
                    {
                        resultNode.SetAttribute("status", ResultType.FAIL);
                        result.Fail();
                    }
                }
                resultNodes.Add(resultNode);
            }
            return resultNodes;
        }
예제 #11
0
 public XmlElement BuildHeadNode(ResultHolder dataHolder, Result result, string methodType)
 {
     string callType = "call";
     if (dataHolder.callType != "")
     {
         callType = dataHolder.callType;
     }
     callType += "result";
     XmlElement headNode = doc.CreateElement(callType);
     headNode.SetAttribute("fixture", dataHolder.fixtureName);
     headNode.SetAttribute("method", dataHolder.fixtureMethod);
     headNode.SetAttribute("status", result.type);
     headNode.SetAttribute("type", methodType);
     if (!dataHolder.skipTime)
     {
         headNode.SetAttribute("time", GetTimeString(dataHolder.GetRunTime()));
     }
     if (dataHolder.paramName != "")
     {
         headNode.SetAttribute("name", dataHolder.paramName);
     }
     XmlElement inputNode = doc.CreateElement("inputkeys");
     foreach (string inputKey in dataHolder.inputKeys)
     {
         XmlElement inputKeyNode = doc.CreateElement(inputKey);
         inputNode.AppendChild(inputKeyNode);
     }
     XmlElement outputNode = doc.CreateElement("outputkeys");
     foreach (string outputKey in dataHolder.outputKeys)
     {
         XmlElement outputKeyNode = doc.CreateElement(outputKey);
         outputKeyNode.SetAttribute("tolerance", GetTolerance(outputKey, dataHolder));
         outputNode.AppendChild(outputKeyNode);
     }
     foreach (string outputKey in dataHolder.multiRowKeys)
     {
         XmlElement outputKeyNode = doc.CreateElement(outputKey);
         outputKeyNode.SetAttribute("tolerance", GetTolerance(outputKey, dataHolder));
         outputNode.AppendChild(outputKeyNode);
     }
     headNode.AppendChild(inputNode);
     headNode.AppendChild(outputNode);
     return headNode;
 }
예제 #12
0
        public void SetUpTest()
        {
            XmlDocument doc = new XmlDocument();
            parser = new ResultParser(doc, null, true);
            holder = new ResultHolder("test", null, true);

            outputDic = new Dictionary<string, string>();
            resultDic = new Dictionary<string, object>();

            dic1 = new Dictionary<string, string>();
            dic2 = new Dictionary<string, string>();
            dic3 = new Dictionary<string, string>();
            dic4 = new Dictionary<string, string>();
            dic5 = new Dictionary<string, string>();
            dic5b = new Dictionary<string, object>();
            dic6 = new Dictionary<string, object>();
            dic7 = new Dictionary<string, object>();
            dic8 = new Dictionary<string, object>();
            dic9 = new Dictionary<string, object>();

            dic1.Add("first", "A");
            dic1.Add("second", "B");
            dic1.Add("third", "C");
            dic1.Add("fourth", "D");

            dic2.Add("first", "A");
            dic2.Add("second", "B");
            dic2.Add("third", "B");
            dic2.Add("fourth", "B");

            dic3.Add("first", "A");
            dic3.Add("second", "C");
            dic3.Add("third", "C");
            dic3.Add("fourth", "C");

            dic4.Add("first", "C");
            dic4.Add("second", "B");
            dic4.Add("third", "C");
            dic4.Add("fourth", "D");

            dic5.Add("first", "C");
            dic5.Add("second", "B");
            dic5.Add("third", "D");
            dic5.Add("fourth", "D");

            dic5b.Add("first", "C");
            dic5b.Add("second", "B");
            dic5b.Add("third", "D");
            dic5b.Add("fourth", "D");

            dic6.Add("first", "A");
            dic6.Add("second", "C");
            dic6.Add("third", "C");
            dic6.Add("fourth", "C");

            dic7.Add("first", "C");
            dic7.Add("second", "B");
            dic7.Add("third", "D");
            dic7.Add("fourth", "C");

            dic8.Add("first", "A");
            dic8.Add("second", "B");
            dic8.Add("third", "B");
            dic8.Add("fourth", "C");

            dic9.Add("first", "A");
            dic9.Add("second", "B");
            dic9.Add("third", "D");
            dic9.Add("fourth", "C");

            holder.LoadOutputKeys(dic1);
        }
예제 #13
0
        public List<Dictionary<string, object>> MatchOutputToResult(ResultHolder dataHolder)
        {
            ResultHolder.MultiRowResult multiResult = dataHolder.multiRows;
            List<Dictionary<string, object>> matchList = new List<Dictionary<string, object>>();
            int listSize = Math.Max(multiResult.multiOutput.Count, multiResult.multiResult.Count);
            for (int nrOfResults = 0; nrOfResults < listSize; nrOfResults++)
            {
                matchList.Add(null);
            }

            List<Dictionary<string, object>> resultCopy = new List<Dictionary<string, object>>();
            foreach (Dictionary<string, object> result in multiResult.multiResult)
            {
                resultCopy.Add(result);
            }

            List<ResultDicObject> defaultResultList = new List<ResultDicObject>();
            int defaultIndex = 0;
            foreach (Dictionary<string, object> result in multiResult.multiResult)
            {
                defaultResultList.Add(new ResultDicObject(defaultIndex, result));
                defaultIndex++;
            }

            List<OutMatchObject> rowOutMatch = new List<OutMatchObject>();
            int outDicCount = 0;
            foreach (Dictionary<string, string> output in multiResult.multiOutput)
            {
                OutMatchObject outMatch = new OutMatchObject(outDicCount);
                int resultDicCounter = 0;
                bool fullMatchFound = false;
                int fullMatchResultIndex = 0;
                foreach (ResultDicObject resultDicObj in defaultResultList)
                {
                    int nrOfMatches = 0;
                    foreach (string key in dataHolder.multiRowKeys)
                    {
                        if (IsDataMatching(key, output, resultDicObj.resultDic, dataHolder.toleranceDic))
                        {
                            nrOfMatches++;
                        }
                    }
                    if (nrOfMatches == dataHolder.multiRowKeys.Count)
                    {
                        fullMatchFound = true;
                        fullMatchResultIndex = resultDicObj.dicItemIndex;
                        break;
                    }
                    ResultMatchObject resMatch = new ResultMatchObject(resultDicObj.dicItemIndex, nrOfMatches);
                    outMatch.AddResult(resMatch);
                    resultDicCounter++;
                }
                if (fullMatchFound)
                {
                    matchList[outDicCount] = resultCopy[fullMatchResultIndex];
                    resultCopy[fullMatchResultIndex] = null;

                    defaultResultList.RemoveAt(resultDicCounter);
                    foreach (OutMatchObject outMatch2 in rowOutMatch)
                    {
                        outMatch2.RemoveResult(resultDicCounter);
                    }
                }
                else
                {
                    rowOutMatch.Add(outMatch);
                }
                outDicCount++;
            }
            PrintMatchMatrix(rowOutMatch);
            int rowSize = System.Math.Min(rowOutMatch.Count, defaultResultList.Count);
            for (int nrOfRows = 0; nrOfRows < rowSize; nrOfRows++)
            {
                int outItemIndex = 0;
                int highestOutItemIndex = 0;
                MatchObject highestMatchObject = null;
                foreach (OutMatchObject outMatch in rowOutMatch)
                {
                    MatchObject matchObject = outMatch.GetHighestMatch();
                    if (highestMatchObject == null || matchObject.highestMatch > highestMatchObject.highestMatch)
                    {
                        highestMatchObject = matchObject;
                        highestOutItemIndex = outItemIndex;
                    }
                    outItemIndex++;
                }
                if (highestMatchObject != null)
                {
                    matchList[highestMatchObject.outIndex] = resultCopy[highestMatchObject.resultIndex];
                    resultCopy[highestMatchObject.resultIndex] = null;

                    rowOutMatch.RemoveAt(highestOutItemIndex);
                    foreach (OutMatchObject outMatch in rowOutMatch)
                    {
                        outMatch.RemoveResult(highestMatchObject.resultItemIndex);
                    }
                }
            }
            if (multiResult.multiOutput.Count < listSize)
            {
                int matchIndex = multiResult.multiOutput.Count;
                foreach (Dictionary<string, object> resultDic in resultCopy)
                {
                    if (resultDic != null)
                    {
                        matchList[matchIndex] = resultDic;
                        matchIndex++;
                    }
                }
            }
            return matchList;
        }
예제 #14
0
 public void CheckResultStatus(ResultHolder dataHolder)
 {
     if (dataHolder == null)
     {
         return;
     }
     if (!dataHolder.IsSuccessful())
     {
         runSuccessful = false;
     }
 }
예제 #15
0
 public void AppendResultTable(XmlElement bodyElement, ResultHolder dataHolder, ResultParser parser)
 {
     XmlNode table = parser.GetResultAsXml(dataHolder);
     if (table == null)
     {
         return;
     }
     bodyElement.AppendChild(table);
     //bodyElement.AppendChild(bodyElement.OwnerDocument.CreateElement("br"));
     CheckResultStatus(dataHolder);
 }