private void cancelOrderBtn_Click(object sender, RoutedEventArgs e) { //If the order is cancelled the stock needs to be updated back and the list with the bikes cleared facade.updateStockBack(); facade.clearBikeList(); //Return to the main window MainWindow window = new MainWindow(); window.Show(); this.Close(); }
public void testUpdateStockBackMethod() { //arrange FacadeManagement facade = FacadeManagement.getInstance(); Stock stock = Stock.getInstance(); int initialAmount = stock.getFrameStock()["Small"]; Bike bike1 = new Bike(); bike1.Frame.FrameColour = "Blue"; bike1.Frame.FrameSize = "Small"; bike1.GroupSet.Gears = "Thumb Shifter"; bike1.GroupSet.Brakes = "Disk Brakes"; bike1.Wheels.WheelsType = "Mountain"; bike1.FinishingSet.HandleBars = "Riser Bars"; bike1.FinishingSet.Saddle = "Forward"; //act facade.addBike(bike1); facade.getTotalCompletionTime(); facade.updateStockBack(); //assert Assert.AreEqual(initialAmount, stock.getFrameStock()["Small"], "Facade updated back method not implemented correctly"); }