public void SetLevel1UnitValueTest() { //test Level 2 Model model = new Model(); ModelValue mv = new ModelValue(); SetModelValueSample(mv); //calculate Level 3 values mv.CalculateLevel4Values(); mv.CalculateLevel3Values(); //create model model.CreateModel(); //GlobalData.GlobalData.globalData.if_assess_modularity = true; //model.TrimModel(); model.CalculateModelWeight(); mv.SetLevel4UnitValue(model.level4_nodes); mv.SetLevel3UnitValue(model.level3_nodes); mv.SetLevel2UnitValue(model.level2_nodes); mv.SetLevel1UnitValue(model.level1_nodes); //verify the value Assert.AreEqual(3.1944350372696791127913786374672, (double)model.level1_nodes[0].value, 0.0001); ////修剪模型的情况 //model.CreateModel(); //GlobalData.GlobalData.globalData.if_assess_modularity = false; //model.TrimModel(); //model.CalculateModelWeight(); //mv.SetLevel4UnitValue(model.level4_nodes); //mv.SetLevel3UnitValue(model.level3_nodes); //mv.SetLevel2UnitValue(model.level2_nodes); //mv.SetLevel1UnitValue(model.level1_nodes); ////验证数值 //Assert.AreEqual(2.8009873001760972650572709221841, (double)model.level1_nodes[0].value, 0.0001); }
public void SetLevel2UnitValueTest() { //test Level 2 Model model = new Model(); ModelValue mv = new ModelValue(); SetModelValueSample(mv); //calculate Level 3 values mv.CalculateLevel4Values(); mv.CalculateLevel3Values(); //create model model.CreateModel(); //GlobalData.GlobalData.globalData.if_assess_modularity = true; //model.TrimModel(); model.CalculateModelWeight(); mv.SetLevel4UnitValue(model.level4_nodes); mv.SetLevel3UnitValue(model.level3_nodes); mv.SetLevel2UnitValue(model.level2_nodes); //verify the value Assert.AreEqual(-0.5814090208767396425967497017122, (double)model.level2_nodes[0].value, 0.0001); Assert.AreEqual(4.5493525993415009929712588253279, (double)model.level2_nodes[1].value, 0.0001); Assert.AreEqual(4.435102352522840320814015528183, (double)model.level2_nodes[2].value, 0.0001); Assert.AreEqual(4.37469421809111477997698989807, (double)model.level2_nodes[3].value, 0.0001); ////修剪模型的情况 //model.CreateModel(); //GlobalData.GlobalData.globalData.if_assess_modularity = false; //model.TrimModel(); //model.CalculateModelWeight(); //mv.SetLevel4UnitValue(model.level4_nodes); //mv.SetLevel3UnitValue(model.level3_nodes); //mv.SetLevel2UnitValue(model.level2_nodes); ////验证数值 //Assert.AreEqual(-0.5814090208767396425967497017122, (double)model.level2_nodes[0].value, 0.0001); //Assert.AreEqual(4.5493525993415009929712588253279, (double)model.level2_nodes[1].value, 0.0001); //Assert.AreEqual(4.435102352522840320814015528183, (double)model.level2_nodes[2].value, 0.0001); }