Ejemplo n.º 1
0
        public ExtractorTest()
        {
            Random r = new Random();

            r.NextBytes(source);

            str = new InstantFigure(InstantFigureMocks.InstantFigure_MemberRubric_FieldsAndPropertiesModel(),
                                    "InstantFigure_MemberRubric_FieldsAndPropertiesModel_ValueType");
            FieldsAndPropertiesModel fom = new FieldsAndPropertiesModel();

            table = new InstantMultemic(str, "InstantMultemic_Compilation_Test");
            rctab = table.New();

            rcobj = rctab.NewFigure();

            foreach (var rubric in str.Rubrics.AsValues())
            {
                if (rubric.FigureFieldId > -1)
                {
                    var field = fom.GetType().GetField(rubric.FigureField.Name,
                                                       BindingFlags.NonPublic | BindingFlags.Instance);
                    if (field == null)
                    {
                        field = fom.GetType().GetField(rubric.RubricName);
                    }
                    if (field == null)
                    {
                        var prop = fom.GetType().GetProperty(rubric.RubricName);
                        if (prop != null)
                        {
                            rcobj[rubric.FigureFieldId] = prop.GetValue(fom);
                        }
                    }
                    else
                    {
                        rcobj[rubric.FigureFieldId] = field.GetValue(fom);
                    }
                }
            }

            for (int i = 0; i < 1000; i++)
            {
                IFigure nrcstr = rctab.NewFigure();
                nrcstr.ValueArray = rcobj.ValueArray;
                rctab.Add(i, nrcstr);
            }

            structBytes  = new byte[rctab.FigureSize];
            structBytes2 = new byte[rctab.FigureSize];

            rcobj.StructureTo(ref structBytes, 0);
        }
        public MathlineTest()
        {
            instFig = new InstantFigure(typeof(MathlineMockModel).GetMembers().Select(m => m.MemberType == MemberTypes.Field ? m :
                                                                                      m.MemberType == MemberTypes.Property ? m :
                                                                                      null).Where(p => p != null).ToArray(),
                                        "InstantFigure_MemberRubric_FieldsAndPropertiesModel");

            instMtic = new InstantMultemic(instFig, "InstantMultemic_Mathline_Test");

            spcMtic = instMtic.New();

            MathlineMockModel fom = new MathlineMockModel();

            for (int i = 0; i < 250 * 1000; i++)
            {
                var f = Mathline_Figure_Helper_Test(spcMtic, fom);
                f["NetPrice"] = (double)f["NetPrice"] + i;
                f["NetCost"]  = (double)f["NetPrice"] / 2;
                spcMtic.Add((long)int.MaxValue + i, f);
            }
        }