Example #1
0
        private void AssertResultValueType(ValueType expected, string name, Dictionary <string, Variable> actualrsltDic = null, Variable actualrslt = null)
        {
            if (actualrslt != null && DataTypeEnum.DecisionTableResult == actualrslt.ValueType)
            {
                AssertDecisionTableResult(expected, name, actualrslt.DecisionTableResult.OutputResult);
                return;
            }

            if (expected.ComponentSpecified)
            {
                if (actualrsltDic != null)
                {
                    AssertResultComponent(expected.Component, name, actualrsltDic);
                    return;
                }
                AssertResultComponent(expected.Component, name, null, actualrslt);
                return;
            }

            if (expected.ListSpecified)
            {
                AssertResultList(expected.List, name, null, actualrslt);
                return;
            }

            AssertResultByIndividualType(TCKHelper.GetValueType(expected.Value), actualrslt, name);
        }
Example #2
0
        public void RunTest(string filename, string testInput, string testName = null)
        {
            var tckmodel = _transformer.Transform(testInput);

            var splitNames = tckmodel.ModelName.Split('.');

            var context = _doer.BuildContext(splitNames[0]);

            foreach (var item in tckmodel.TestCase)
            {
                var inputdict = new Dictionary <string, Variable> ();

                var inputNameDict = TCKHelper.MakeInputData(item, context);

                context.InputNameDict = inputNameDict;

                foreach (var rsltNode in item.ResultNode)
                {
                    if (testName == null || rsltNode.Name.Contains(testName))
                    {
                        var rslt = _doer.EvaluateDecisions(context, splitNames[0], null, rsltNode.Name);

                        switch (rsltNode.Type)
                        {
                        case "decision":
                        case null:
                            AssertResult(rsltNode, rslt);
                            break;

                        default:
                            throw new TCKException($"The following TCK test type: {rsltNode.Type} is not supported");
                        }
                    }
                }
            }
        }