public void SPRecalculateRecurse() { ISPTest spHelper = makeSPHelper("RecalculateRecurse", m_connectionString); spHelper.InitData(); int res = spHelper.Run(503, 2); Assert.AreEqual(2, res); }
public void SPRecalculateCostsForAssembly() { ISPTest spHelper = makeSPHelper("RecalculateCostsForAssembly", m_connectionString); spHelper.InitData(); // 1 SPRecalculateCostSimple int res = spHelper.Run(501); // just own cost, no compound Assert.AreEqual(10, res); // 2 SPRecalculateCostCompoundOne res = spHelper.Run(503); // 503 own cost + 501 own cost Assert.AreEqual(40, res); // 3 SPRecalculateCostCompoundOneQuant2 res = spHelper.Run(504); // 504 + 2*502 Assert.AreEqual(80, res); // 4 SPRecalculateCostCompoundTwo res = spHelper.Run(505); // 505 + (501 + 502) Assert.AreEqual(80, res); // 5 SPRecalculateCostCompoundTwoQuant2 res = spHelper.Run(506); // 506 + (2*501 + 2*502) Assert.AreEqual(120, res); // 6 SPRecalculateCostCompoundLev2 res = spHelper.Run(507); // 507 + (2*504 + 2*505) Assert.AreEqual(390, res); // 7 SPRecalculateCostCompoundComplex // 80 (own) + 4*501 + 3*502 + 2*503 + 2*504 + 3*505 + 2*506 + 507 = // 80 + 40 + 60 + 2*40 + 2*80 + 3*80 + 2*120 + 390 = // 180 + 80 + 160 + 240 + 240 + 390 = // 1290 res = spHelper.Run(508); Assert.AreEqual(1290, res); // 8 SPRecalculateCostNoOwnCost() res = spHelper.Run(500); // 0 + 5*502 + 507 Assert.AreEqual(490, res); // 9 SPRecalculateCostZeroPartInFirstLevel() // Tests the fetch loop on the subparts of the next sublevel, // specifically the case when one of the sublevel parts returns 0 cost res = spHelper.Run(511); // 1000 + 12 + 0 = 1012 Assert.AreEqual(1012, res); }