void test_Mtch_2() { Log.set(" test_Mtch_2: Rule 15 и Group < B12,5 , 1900x1600 > "); rule = new Rule.Rule(15); ElmAttSet.ElmAttSet elB = new ElmAttSet.ElmAttSet( "ID56A7442F-0000-0D7B-3134-353338303236", "B12,5", "Concrete", "1900x1600", 0, 0, 0, 1000); Dictionary <string, ElmAttSet.ElmAttSet> els = new Dictionary <string, ElmAttSet.ElmAttSet>(); els.Add(elB.guid, elB); List <string> guids = new List <string>(); guids.Add(elB.guid); var model = new Model.Model(); model.setElements(els); model.getGroups(); var gr = model.elmGroups[0]; TST.Eq(gr.guids.Count, 1); var match = new Mtch(gr, rule); TST.Eq(match.ok == OK.Match, true); var cmp = match.component; //31/3 TST.Eq(cmp.fps[SType.Material].pars[0].par.ToString(), "b12,5"); Log.exit(); }
void test_Mtch_3() { Log.set(" test_Mtch_3: Rule 5 и Group < C235, Pl30 >"); rule = new Rule.Rule(5); ElmAttSet.ElmAttSet elm = new ElmAttSet.ElmAttSet( "ID56A7442F-0000-0D74-3134-353338303236", "C235", "Steel", "Pl30", 0, 0, 0, 1001); Dictionary <string, ElmAttSet.ElmAttSet> els = new Dictionary <string, ElmAttSet.ElmAttSet>(); els.Add(elm.guid, elm); List <string> guids = new List <string>(); guids.Add(elm.guid); var model = new Model.Model(); model.setElements(els); model.getGroups(); var gr = model.elmGroups[0]; TST.Eq(gr.guids.Count, 1); TST.Eq(gr.mat, "c235"); TST.Eq(gr.prf, "pl30"); var doc = Docs.getDoc("Полоса СтальхолдингM"); var csDP = new Dictionary <SType, string>(); //31/3 csFPs = rule.Parser(FP.type.CompSet, doc.LoadDescription); // 2/4 Comp comp1 = new Comp(doc, 2, csDP); // 2/4 Comp comp2 = new Comp(doc, 12, csDP); // 2/4 List<Comp> comps = new List<Comp> { comp1, comp2 }; // 2/4 CS cs = new CS("test_CS", null, rule, doc.LoadDescription, comps); // 2/4 TST.Eq(cs.csDP.Count, 4); //////////////////////////TST.Eq(comp1.isMatch(gr, rule), false); //////////////////////////TST.Eq(comp2.isMatch(gr, rule), true); Log.exit(); }
////////////// private void test_getSectionText() ////////////// { ////////////// Log.set("test_getSectionTest(Section.Material, text"); //28/5/////////////// 7/3/2017 ///////////////// TST.Eq(getSectionText(FP.Section.Material, "Профиль: L 20 x 5; M: C245; Price: 2690"), "c245"); ////////////// Log.exit(); ////////////// } //////////////private void test_isSectionMatch() //////////////{ ////////////// Log.set("isSectionMatch(Section.Material, C245, rule.text)"); ////////////// /////// 7/3/2017 //// bool ok = isSectionMatch(FP.Section.Material, "C245", "Профиль: L * x * ст*; длина: * = * м; M: ст *;"); ////////////// Log.exit(); //////////////} private void test_Mtch_1() { Log.set(" test_Mtch_1: Rule 4 и Group<C255, L20x4>"); Rule.Rule rule = new Rule.Rule(4); ElmAttSet.ElmAttSet el = new ElmAttSet.ElmAttSet( "ID56A7442F-0000-0D70-3134-353338303236", "C245", "Steel", "Уголок20X4", 0, 0, 0, 1000); Dictionary <string, ElmAttSet.ElmAttSet> els = new Dictionary <string, ElmAttSet.ElmAttSet>(); els.Add(el.guid, el); List <string> guids = new List <string>(); guids.Add(el.guid); ElmAttSet.Group gr = new ElmAttSet.Group(els, "C245", "Уголок20X4", guids); Mtch match = new Mtch(gr, rule); TST.Eq(match.ok == OK.Match, true); Log.exit(); }