Beispiel #1
0
        public string Test3()
        {
            StringBuilder Sb = new StringBuilder();
            List <Rule>   L  = RuleHelper.GetAllRules(true);
            {
                Type   R     = typeof(Rule);
                Type[] Types = GetTypes();
                int    count = 0;
                foreach (Type T in Types)
                {
                    if (T.BaseType == R)
                    {
                        Rule R2 = (Rule)Activator.CreateInstance(T);
                        if (R2.Identifier.ToLower() == "genricvruttam")
                        {
                            continue;
                        }
                        //Debug2.AppendLine ( R2.Name + "," + R2.PadyamType + "," + R2.PadyamSubType + "," + R2.CharLength );
                        count++;

                        if (T.Namespace == "Library.Chandam.Sans")
                        {
                            if (R2.Yati.Length >= 1)
                            {
                                Debug2.AppendLine(R2.Name);
                                continue;
                            }
                            //Sb.AppendLine ( "case "+R2.Identifier+": return new " + R2.Identifier + "();" );
                            Sb.AppendLine("new " + R2.Identifier + "(),");
                        }
                    }
                }
                return(Sb.ToString());
            }
        }
Beispiel #2
0
        public string Test2()
        {
            StringBuilder Sb  = new StringBuilder();
            StringBuilder Sb2 = new StringBuilder();
            StringBuilder Sb3 = new StringBuilder();
            StringBuilder Sb4 = new StringBuilder();

            List <Rule> L = RuleHelper.GetAllRules(true);

            {
                Type   R     = typeof(Rule);
                Type[] Types = GetTypes();
                int    count = 0;
                foreach (Type T in Types)
                {
                    if (T.BaseType == R)
                    {
                        Rule R2 = (Rule)Activator.CreateInstance(T);



                        if (R2.Identifier.ToLower() == "genricvruttam")
                        {
                            continue;
                        }
                        Debug2.AppendLine(R2.Name + "," + R2.PadyamType + "," + R2.PadyamSubType + "," + R2.CharLength);
                        count++;


                        int expected = Helper.CalcThreshold(R2);
                        int actual   = R2.Threshold;
                        if (actual != expected)
                        {
                            Sb.AppendLine(R2.Name + "- Wrong Thresold- Expected: " + expected + "-Actual:" + actual);
                        }
                        foreach (string s in R2.Examples)
                        {
                            if (string.IsNullOrEmpty(s))
                            {
                                Sb.AppendLine(R2.Name + "- Has Blank Example.. " + R2.Identifier);
                            }
                        }

                        if (R2.Identifier != T.Name)
                        {
                            Sb.AppendLine(T.Name + "- Wrong Identifier Actaul: " + R2.Identifier);
                        }
                        //if ( R2.ShortName != R2.Name )
                        //{
                        //    Sb.AppendLine ( R2.Name + "- Wrong Short Name Actaul: " + R2.ShortName );

                        //}

                        bool found = false;
                        foreach (Rule R4 in L)
                        {
                            if (R2.GetType() == R4.GetType())
                            {
                                found = true;
                            }
                        }

                        if (!found)
                        {
                            Sb.AppendLine(T.Name + "- Not found ");
                            Sb3.Append("new " + T.Name + "(),");
                        }


                        Rule R3 = Manager.FetchRule(R2.Identifier);
                        if (R3 == null)
                        {
                            Sb.AppendLine(T.Name + "- Get Item Not Exists");
                            Sb2.AppendLine("case \"" + T.Name + "\": return  new " + T.Name + "();");
                        }
                        else
                        {
                            if (R2.GetType() != R3.GetType())
                            {
                                Sb.AppendLine(T.Name + "-  Wrong Get Item");
                                Sb2.AppendLine("case \"" + T.Name + "\": return  new " + T.Name + "();");
                            }
                        }
                    }
                }
                if (count != L.Count)
                {
                    Sb.AppendLine("No. of Items are not matching...");
                }
                if (Sb.ToString() == "")
                {
                    Sb.AppendLine("Perfect  and Total Items are " + count);
                }
            }
            Sb.Append(Sb2.ToString());
            Sb.Append(Sb3.ToString());

            return(Sb.ToString());
        }