public void ScenarioCCTest() { if (File.Exists(SkuIddatapath)) { File.Delete(SkuIddatapath); } JsonParser.JsonParserToList(path, promotionData); SkuIdPrice skuidPrice = new SkuIdPrice(); blSkuIdPrice skuIdPrice = new blSkuIdPrice(); skuidPrice = skuIdPrice.GetSkuIdPrice(3); calculateResult.AddDataToJson(skuidPrice, SkuIddatapath); Global.resultSkuIdPrice = JsonParser.JsonParserToActivePromotion(SkuIddatapath); Assert.Equal(30, calculateResult.CalculateFinalResult(4, 4, 1, SkuIddatapath)); }
public int CalculateFinalResult(int skuId, int promptioid, int orderUnit) { int calculateValue = 0; try { blActivePromotion blActivePromotion = new blActivePromotion(); ActivePromotion activePromotion = blActivePromotion.GetActivePromotion(promptioid); blSkuIdPrice blSkuIdPrice = new blSkuIdPrice(); SkuIdPrice skuidPrice = blSkuIdPrice.GetSkuIdPrice(skuId); //int orderUnit = Convert.ToInt32(txtUnit.Text); int remainingUnit = orderUnit % activePromotion.unit * skuidPrice.unitprice; int groupedUnit = orderUnit / activePromotion.unit * activePromotion.Promotions; calculateValue = remainingUnit + groupedUnit; } catch (System.Exception) { throw; } return(calculateValue); }