public void TotalPrice() { Order order = new Order(); KitComposer.AddComponent(order, new Dictionary <string, string>() { { "reference", "Cornières" }, { "color", "Blanc" }, { "height", "36" }, { "quantity", "4" } }); KitComposer.AddComponent(order, new Dictionary <string, string>() { { "reference", "Traverse Ar" }, { "width", "32" }, { "quantity", "2" } }); Utils.FetchFromDataBase(order.Components); order.ComputePrice(); Assert.AreEqual(order.Components[0]["quantity"], "4"); Assert.AreEqual(order.Components[0]["price"], "0.35"); Assert.AreEqual(order.Components[1]["quantity"], "2"); Assert.AreEqual(order.Components[1]["price"], "1"); Assert.AreEqual(order.TotalPrice, 3.4); }
public OrderRecapViewModel(Cupboard cupboard) { Utils.DBConnection = new SQLiteConnection("Data Source=" + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\KitBox\db.sqlite;Version=3;"); m_Cupboard = cupboard; Order = new Order(); KitComposer.ComposeKit(Order, cupboard); Order.CheckStock(); FlowDocument = new FlowDocument(); CreateRecap(); }