Exemplo n.º 1
0
        public void OnAddOrderItemButtonClicked(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    IOrderItem       item;
                    FrameworkElement screen = null;
                    switch (button.Tag)
                    {
                    //cases for entrees
                    case "CowpokeChili":

                        item               = new CowpokeChili();
                        screen             = new CowpokeChiliCustomization();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "AngryChicken":

                        item               = new AngryChicken();
                        screen             = new AngryChickenCustomization();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "DakotaDoubleBurger":

                        item               = new DakotaDoubleBurger();
                        screen             = new DakotaDoubleBurgerCustomization();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "PecosPulledPork":

                        item               = new PecosPulledPork();
                        screen             = new PecosPulledPorkCustomization();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "TrailBurger":

                        item               = new TrailBurger();
                        screen             = new TrailBurgerCustomization();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "TexasTripleBurger":

                        item               = new TexasTripleBurger();
                        screen             = new TexasTripleBurgerCustomization();
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    // No screenswap is needed as the Ribs have no special instructions
                    case "RustlersRibs":

                        item = new RustlersRibs();
                        order.Add(item);
                        break;


                    // Separator for Sides

                    case "BakedBeans":
                        item               = new BakedBeans();
                        screen             = new SizeCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "ChiliCheeseFries":
                        item               = new ChiliCheeseFries();
                        screen             = new SizeCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "CornDodgers":
                        item               = new CornDodgers();
                        screen             = new SizeCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "PanDeCampo":
                        item               = new PanDeCampo();
                        screen             = new SizeCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    // And finally drinks

                    case "Water":
                        item               = new Water();
                        screen             = new WaterCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "JerkedSoda":
                        item               = new JerkedSoda();
                        screen             = new JerkedSodaCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "CowboyCoffee":
                        item               = new CowboyCoffee();
                        screen             = new CowboyCoffeeCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;

                    case "TexasTea":
                        item               = new TexasTea();
                        screen             = new TexasTeaCustomization(DataContext);
                        screen.DataContext = item;
                        order.Add(item);
                        orderControl?.SwapScreen(screen);
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void ChangingSpecialInstructionsPropertyShouldInvokePropertyChangedForSpecialInstructions()
        {
            var chili = new CowpokeChili();

            Assert.PropertyChanged(chili, "SpecialInstructions", () => { chili.GreenOnions = false; });
        }
Exemplo n.º 3
0
        /// <summary>
        /// This method adds entrees to the list by converting the
        /// sender object to a button and filtering on the name of the button
        /// that was pressed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddItemToList(object sender, RoutedEventArgs e)
        {
            //Ensure the DataContext is an Order and not NULL
            if (DataContext is Order data)
            {
                if (sender is Button)
                {
                    IOrderItem       item;
                    FrameworkElement screen = null;
                    var orderControl        = this.FindAncestor <OrderControl>();

                    //Cast sender to button
                    Button b = (Button)sender;

                    //Filter which button was pressed based on name
                    switch (b.Name)
                    {
                    case "AddAngryChickenButton":
                        item   = new AngryChicken();
                        screen = new AngryChickenCustomization(DataContext);
                        break;

                    case "AddCowpokeChiliButton":
                        item   = new CowpokeChili();
                        screen = new CowpokeChiliCustomization(DataContext);
                        break;

                    case "AddDakotaDoubleBurgerButton":
                        item   = new DakotaDoubleBurger();
                        screen = new DakotaDoubleCustomization(DataContext);
                        break;

                    case "AddPecosPulledPorkButton":
                        item   = new PecosPulledPork();
                        screen = new PecosPulledPorkCustomization(DataContext);
                        break;

                    case "AddRustlersRibsButton":
                        item = new RustlersRibs();
                        break;

                    case "AddTexasTripleBurgerButton":
                        item   = new TexasTripleBurger();
                        screen = new TexasTripleCustomization(DataContext);
                        break;

                    case "AddTrailBurgerButton":
                        item   = new TrailBurger();
                        screen = new TrailBurgerCustomization(DataContext);
                        break;

                    case "AddBakedBeansButton":
                        item = new BakedBeans();
                        break;

                    case "AddChiliCheeseFriesButton":
                        item = new ChiliCheeseFries();
                        break;

                    case "AddCornDodgersButton":
                        item = new CornDodgers();
                        break;

                    case "AddPandeCampoButton":
                        item = new PanDeCampo();
                        break;

                    case "AddCowboyCoffeeButton":
                        item   = new CowboyCoffee();
                        screen = new CowboyCoffeeCustomization(DataContext);
                        break;

                    case "AddJerkedSodaButton":
                        item   = new JerkedSoda();
                        screen = new JerkedSodaCustomization(DataContext);
                        break;

                    case "AddTexasTeaButton":
                        item   = new TexasTea();
                        screen = new TexasTeaCustomization(DataContext);
                        break;

                    case "AddWaterButton":
                        item   = new Water();
                        screen = new WaterCustomization(DataContext);
                        break;

                    default:
                        throw new NotImplementedException("Unknown button clicked");
                    }
                    if (screen != null)
                    {
                        screen.DataContext = item;
                    }
                    data.Add(item);
                    orderControl?.SwapScreen(screen);
                }
            }
        }
Exemplo n.º 4
0
        public void DefaultSpecialInstructionsShouldBeEmpty()
        {
            var chili = new CowpokeChili();

            Assert.Empty(chili.SpecialInstructions);
        }
Exemplo n.º 5
0
 public CustomizedCowpokeChili(CowpokeChili cc)
 {
     c = cc;
     InitializeComponent();
 }
        /// <summary>
        /// This method adds entrees to the list by converting the
        /// sender object to a button and filtering on the name of the button
        /// that was pressed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void addEntreeToList(object sender, RoutedEventArgs e)
        {
            //Ensure the DataContext is an Order and not NULL
            if (DataContext is Order data)
            {
                if (sender is Button)
                {
                    IOrderItem       item;
                    FrameworkElement screen = null;
                    var orderControl        = this.FindAncestor <OrderControl>();

                    //Cast sender to button
                    Button b = (Button)sender;

                    //Filter which button was pressed based on name
                    switch (b.Name)
                    {
                    case "AngryChickenButton":
                        item   = new AngryChicken();
                        screen = new AngryChickenCustomization(DataContext);
                        break;

                    case "CowpokeChiliButton":
                        item   = new CowpokeChili();
                        screen = new CowpokeChiliCustomization(DataContext);
                        break;

                    case "DakotaDoubleButton":
                        item   = new DakotaDoubleBurger();
                        screen = new DakotaDoubleCustomization(DataContext);
                        break;

                    case "PecosPulledPorkButton":
                        item   = new PecosPulledPork();
                        screen = new PecosPulledPorkCustomization(DataContext);
                        break;

                    case "RustlersRibsButton":
                        item   = new RustlersRibs();
                        screen = new RustlersRibsCustomization();
                        break;

                    case "TexasTripleButton":
                        item   = new TexasTripleBurger();
                        screen = new TexasTripleCustomization(DataContext);
                        break;

                    case "TrailBurgerButton":
                        item   = new TrailBurger();
                        screen = new TrailBurgerCustomization(DataContext);
                        break;

                    default:
                        throw new NotImplementedException("Unknown entree button clicked");
                    }
                    if (screen != null)
                    {
                        screen.DataContext = item;
                    }
                    data.Add(item);
                    orderControl?.SwapScreen(screen);
                }
            }
        }
        public void CowpokeChiliShouldImplementINotifyPropertyChanged()
        {
            var chili = new CowpokeChili();

            Assert.IsAssignableFrom <INotifyPropertyChanged>(chili);
        }
        public void ChangingTortillaStripsShouldInvokeINotifyPropertyChangedForSpecialInstructions()
        {
            var chili = new CowpokeChili();

            Assert.PropertyChanged(chili, "SpecialInstructions", () => { chili.TortillaStrips = false; });
        }
        /// <summary>
        /// Updates the screen to the item selected customize screen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnItemAddButtonClicked(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    switch (button.Tag)
                    {
                    case "CowpokeChili":
                        var entree = new CowpokeChili();
                        var screen = new CustomizeCowpokeChili();
                        screen.DataContext = entree;
                        order.Add(entree);
                        orderControl.SwapScreen(screen);
                        break;

                    case "RustlersRibs":
                        var entree2 = new RustlersRibs();
                        var screen2 = new CustomizeRustlersRibs();
                        screen2.DataContext = entree2;
                        order.Add(entree2);
                        orderControl.SwapScreen(screen2);
                        break;

                    case "PecosPulledPork":
                        var entree3 = new PecosPulledPork();
                        var screen3 = new CustomizePecosPulledPork();
                        screen3.DataContext = entree3;
                        order.Add(entree3);
                        orderControl.SwapScreen(screen3);
                        break;

                    case "TrailBurger":
                        var entree4 = new TrailBurger();
                        var screen4 = new CustomizeTrailBurger();
                        screen4.DataContext = entree4;
                        order.Add(entree4);
                        orderControl.SwapScreen(screen4);
                        break;

                    case "DakotaDoubleBurger":
                        var entree5 = new DakotaDoubleBurger();
                        var screen5 = new CustomizeDakotaDoubleBurger();
                        screen5.DataContext = entree5;
                        order.Add(entree5);
                        orderControl.SwapScreen(screen5);
                        break;

                    case "TexasTripleBurger":
                        var entree6 = new TexasTripleBurger();
                        var screen6 = new CustomizeTexasTripleBurger();
                        screen6.DataContext = entree6;
                        order.Add(entree6);
                        orderControl.SwapScreen(screen6);
                        break;

                    case "AngryChicken":
                        var entree7 = new AngryChicken();
                        var screen7 = new CustomizeAngryChicken();
                        screen7.DataContext = entree7;
                        order.Add(entree7);
                        orderControl.SwapScreen(screen7);
                        break;

                    case "ChiliCheeseFries":
                        var entree8 = new ChiliCheeseFries();
                        var screen8 = new CustomizeChiliCheeseFries();
                        screen8.DataContext = entree8;
                        order.Add(entree8);
                        orderControl.SwapScreen(screen8);
                        break;

                    case "CornDodgers":
                        var entree9 = new CornDodgers();
                        var screen9 = new CustomizeCornDodgers();
                        screen9.DataContext = entree9;
                        order.Add(entree9);
                        orderControl.SwapScreen(screen9);
                        break;

                    case "PanDeCampo":
                        var entree10 = new PanDeCampo();
                        var screen10 = new CustomizePanDeCampo();
                        screen10.DataContext = entree10;
                        order.Add(entree10);
                        orderControl.SwapScreen(screen10);
                        break;

                    case "BakedBeans":
                        var entree11 = new BakedBeans();
                        var screen11 = new CustomizeBakedBeans();
                        screen11.DataContext = entree11;
                        order.Add(entree11);
                        orderControl.SwapScreen(screen11);
                        break;

                    case "JerkedSoda":
                        var entree12 = new JerkedSoda();
                        var screen12 = new CustomizeJerkedSoda();
                        screen12.DataContext = entree12;
                        order.Add(entree12);
                        orderControl.SwapScreen(screen12);
                        break;

                    case "TexasTea":
                        var entree13 = new TexasTea();
                        var screen13 = new CustomizeTexasTea();
                        screen13.DataContext = entree13;
                        order.Add(entree13);
                        orderControl.SwapScreen(screen13);
                        break;

                    case "CowboyCoffee":
                        var entree14 = new CowboyCoffee();
                        var screen14 = new CustomizeCowboyCoffee();
                        screen14.DataContext = entree14;
                        order.Add(entree14);
                        orderControl.SwapScreen(screen14);
                        break;

                    case "Water":
                        var entree15 = new Water();
                        var screen15 = new CustomizeWater();
                        screen15.DataContext = entree15;
                        order.Add(entree15);
                        orderControl.SwapScreen(screen15);
                        break;
                    }
                }
            }
        }
        public void ChangingGreenOnionsShouldInvokeINotifyPropertyChangedForGreenOnions()
        {
            var chili = new CowpokeChili();

            Assert.PropertyChanged(chili, "GreenOnions", () => { chili.GreenOnions = false; });
        }
        public void ChanginTortillaStripsShouldInvokeINotifyPropertyChangedForTortillaStrips()
        {
            var chili = new CowpokeChili();

            Assert.PropertyChanged(chili, "SourCream", () => { chili.SourCream = false; });
        }
        public void ChangingSourCreamShouldInvokeINotifyPropertyChangedForSpecialInstructions()
        {
            var chili = new CowpokeChili();

            Assert.PropertyChanged(chili, "SpecialInstructions", () => { chili.SourCream = false; });
        }
Exemplo n.º 13
0
        public void CowboyCoffeeShouldImplementINotifyPropertyChanged()
        {
            var item = new CowpokeChili();

            Assert.IsAssignableFrom <INotifyPropertyChanged>(item);
        }
        public void CowPokeChilliImplementsINotifyPropertyChanged()
        {
            var cpc = new CowpokeChili();

            Assert.IsAssignableFrom <INotifyPropertyChanged>(cpc);
        }
Exemplo n.º 15
0
        // Generic handler for ItemAddButton clicked event
        public void OnItemAddButtonClicked(object sender, RoutedEventArgs e)
        {
            orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    IOrderItem            item   = null;
                    OrderCustomizeControl screen = new OrderCustomizeControl();

                    switch (button.Tag)
                    {
                    case "Angry Chicken":
                        item = new AngryChicken();
                        break;

                    case "Cowpoke Chili":
                        item = new CowpokeChili();
                        break;

                    case "Dakota Double Burger":
                        item = new DakotaDoubleBurger();
                        break;

                    case "Pecos Pulled Pork":
                        item = new PecosPulledPork();
                        break;

                    case "Rustlers Ribs":
                        item = new RustlersRibs();
                        break;

                    case "Texas Triple Burger":
                        item = new TexasTripleBurger();
                        break;

                    case "Trail Burger":
                        item = new TrailBurger();
                        break;

                    case "Baked Beans":
                        item = new BakedBeans();
                        break;

                    case "Chili Cheese Fries":
                        item = new ChiliCheeseFries();
                        break;

                    case "Corn Dodgers":
                        item = new CornDodgers();
                        break;

                    case "Pan de Campo":
                        item = new PanDeCampo();
                        break;

                    case "Cowboy Coffee":
                        item = new CowboyCoffee();
                        break;

                    case "Jerked Soda":
                        item = new JerkedSoda();
                        break;

                    case "Texas Tea":
                        item = new TexasTea();
                        break;

                    case "Water":
                        item = new Water();
                        break;

                    default:
                        throw new NotImplementedException();
                    }

                    screen.DataContext = item;
                    order.AddItem(item);
                    orderControl.SwapScreen(screen); // Switch screen
                }
            }
        }
Exemplo n.º 16
0
        /// <summary>
        /// Event handler for menuitem buttons calls correct constructor for button chosen and adds to the list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnItemAddButtonClicked(object sender, RoutedEventArgs e)
        {
            orderControl = this.FindAncestor <OrderControl>();
            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    IOrderItem nItem;
                    switch (button.Tag)
                    {
                    case "CowpokeChili":
                        nItem = new CowpokeChili();
                        var screen = new CustomizeCowpokeChili();
                        screen.DataContext = nItem;
                        order.Add(new CowpokeChili());
                        orderControl.SwapScreen(new CustomizeCowpokeChili());
                        break;

                    case "AngryChicken":
                        nItem = new AngryChicken();
                        // var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        order.Add(new AngryChicken());
                        //orderControl.SwapScreen(new CustomizeCowpokeChili());
                        break;

                    case "BakedBeans":
                        nItem = new BakedBeans();
                        // var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        order.Add(new BakedBeans());
                        //orderControl.SwapScreen(new CustomizeCowpokeChili());
                        break;

                    case "ChiliCheeseFries":
                        nItem = new ChiliCheeseFries();
                        // var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        order.Add(new ChiliCheeseFries());
                        //orderControl.SwapScreen(new CustomizeCowpokeChili());
                        break;

                    case "CornDodgers":
                        nItem = new CornDodgers();
                        // var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        order.Add(new CornDodgers());
                        //orderControl.SwapScreen(new CustomizeCowpokeChili());
                        break;

                    case "CowboyCoffee":
                        nItem = new CowboyCoffee();
                        // var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        order.Add(new CowboyCoffee());
                        //orderControl.SwapScreen(new CustomizeCowpokeChili());
                        break;

                    case "DakotaDoubleBurger":
                        nItem = new DakotaDoubleBurger();
                        // var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        order.Add(new DakotaDoubleBurger());
                        //orderControl.SwapScreen(new CustomizeCowpokeChili());
                        break;

                    case "JerkedSoda":
                        nItem = new JerkedSoda();
                        // var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        order.Add(new JerkedSoda());
                        //orderControl.SwapScreen(new CustomizeCowpokeChili());
                        break;

                    case "PanDeCampo":
                        nItem = new PanDeCampo();
                        // var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        order.Add(new PanDeCampo());
                        //orderControl.SwapScreen(new CustomizeCowpokeChili());
                        break;

                    case "PecosPulledPork":
                        nItem = new PecosPulledPork();
                        // var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        order.Add(new PecosPulledPork());
                        //orderControl.SwapScreen(new CustomizeCowpokeChili());
                        break;

                    case "RustlersRibs":
                        nItem = new RustlersRibs();
                        // var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        order.Add(new RustlersRibs());
                        //orderControl.SwapScreen(new CustomizeCowpokeChili());
                        break;

                    case "TexasTea":
                        nItem = new TexasTea();
                        // var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        order.Add(new TexasTea());
                        //orderControl.SwapScreen(new CustomizeCowpokeChili());
                        break;

                    case "TexasTripleBurger":
                        nItem = new TexasTripleBurger();
                        // var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        order.Add(new TexasTripleBurger());
                        //orderControl.SwapScreen(new CustomizeCowpokeChili());
                        break;

                    case "TrailBurger":
                        nItem = new BakedBeans();
                        // var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        order.Add(new TrailBurger());
                        //orderControl.SwapScreen(new CustomizeCowpokeChili());
                        break;

                    case "Water":
                        nItem = new BakedBeans();
                        // var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        order.Add(new CowboyCoffee());
                        //orderControl.SwapScreen(new CustomizeCowpokeChili());
                        break;
                    }
                }
            }
        }
        public void OnItemAddEntreeClicked(object sender, RoutedEventArgs e)
        {
            IOrderItem entree;
            var        orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    switch (button.Name)
                    {
                    case "AddCowPokeChilli":
                        entree = new CowpokeChili();
                        var screen = new CustomizeEntree();
                        screen.DataContext = entree;
                        order.Add(entree);
                        orderControl.SwapScreen(screen);
                        screen.Title.Text = "Customize Cowpoke Chilli";
                        screen.ChilliMenu();
                        break;

                    case "AddRustlersRibs":
                        entree = new RustlersRibs();
                        var screen2 = new CustomizeEntree();
                        screen2.DataContext = entree;
                        order.Add(entree);
                        orderControl.SwapScreen(screen2);
                        screen2.Title.Text = "Customize Rustler's Ribs";
                        break;

                    case "AddPecosPulledPork":
                        entree = new PecosPulledPork();
                        var screen3 = new CustomizeEntree();
                        screen3.DataContext = entree;
                        order.Add(entree);
                        orderControl.SwapScreen(screen3);
                        screen3.Title.Text = "Customize Pecos Pulled Pork";
                        screen3.PecosPulledPork();
                        break;

                    case "AddTrailBurger":
                        entree = new TrailBurger();
                        var screen4 = new CustomizeEntree();
                        screen4.DataContext = entree;
                        order.Add(entree);
                        orderControl.SwapScreen(screen4);
                        screen4.Title.Text = "Customize Trail Burger";
                        screen4.TrailBurger();
                        break;

                    case "DakotaDoubleBurger":
                        entree = new DakotaDoubleBurger();
                        var screen5 = new CustomizeEntree();
                        screen5.DataContext = entree;
                        order.Add(entree);
                        orderControl.SwapScreen(screen5);
                        screen5.Title.Text = "Customize Dakota Double Burger";
                        screen5.DakotaDouble();
                        break;

                    case "AddTexasTripleBurger":
                        entree = new TexasTripleBurger();
                        var screen6 = new CustomizeEntree();
                        screen6.DataContext = entree;
                        order.Add(entree);
                        orderControl.SwapScreen(screen6);
                        screen6.Title.Text = "Customize Texas Triple Burger";
                        screen6.TexasTriple();
                        break;

                    case "AddAngryChicken":
                        entree = new AngryChicken();
                        var screen7 = new CustomizeEntree();
                        screen7.DataContext = entree;
                        order.Add(entree);
                        orderControl.SwapScreen(screen7);
                        screen7.Title.Text = "Customize Angry Chicken";
                        screen7.AngryChickenMenu();
                        break;
                    }
                }
            }
        }
Exemplo n.º 18
0
        public void ChangingCheesePropertyShouldInvokePropertyChangedForCheese()
        {
            var chili = new CowpokeChili();

            Assert.PropertyChanged(chili, "Cheese", () => { chili.Cheese = false; });
        }
Exemplo n.º 19
0
        /// <summary>
        /// whenver a button is clicked this will run switches for
        /// tags on the button names to find which item to add
        /// to the order list
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnItemAddButtonClicked(object sender, RoutedEventArgs e)
        {
            var orderControl = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    switch (button.Tag)
                    {
                    case "CowpokeChili":
                        var item   = new CowpokeChili();
                        var screen = new CustomizeCowpokeChili();
                        AddItemAndOpenCustomizationScreen(item, screen);

                        //var entree = new CowpokeChili();
                        //order.Add(entree);
                        //var screen = new CustomizeCowpokeChili();
                        //screen.DataContext = entree;
                        //order.Add(entree);
                        //orderControl.SwapScreen(screen);
                        break;

                    case "AngryChicken":
                        var chicken       = new AngryChicken();
                        var chickenScreen = new CustomizeAngryChicken();
                        AddItemAndOpenCustomizationScreen(chicken, chickenScreen);

                        break;

                    case "DakotaDouble":
                        var dakota       = new DakotaDoubleBurger();
                        var dakotaScreen = new CustomizeDakotaDouble();
                        AddItemAndOpenCustomizationScreen(dakota, dakotaScreen);

                        break;

                    case "RustlersRibs":
                        order.Add(new RustlersRibs());

                        break;

                    case "TexasTriple":
                        var texas       = new TexasTripleBurger();
                        var texasScreen = new CustomizeTexasTriple();
                        AddItemAndOpenCustomizationScreen(texas, texasScreen);

                        break;

                    case "PecosPulledPork":
                        var pork       = new PecosPulledPork();
                        var porkScreen = new CustomizePecosPulledPork();
                        AddItemAndOpenCustomizationScreen(pork, porkScreen);

                        break;

                    case "TrailBurger":
                        var trail       = new TrailBurger();
                        var trailScreen = new CustomizeTrailBurger();
                        AddItemAndOpenCustomizationScreen(trail, trailScreen);

                        break;

                    case "ChiliCheeseFries":
                        var fries       = new ChiliCheeseFries();
                        var friesScreen = new CustomizeSide();
                        AddItemAndOpenCustomizationScreen(fries, friesScreen);

                        break;

                    case "PanDeCampo":
                        var panDeCampo       = new PanDeCampo();
                        var panDeCampoScreen = new CustomizeSide();
                        AddItemAndOpenCustomizationScreen(panDeCampo, panDeCampoScreen);

                        break;

                    case "BakedBeans":
                        var beans       = new BakedBeans();
                        var beansScreen = new CustomizeSide();
                        AddItemAndOpenCustomizationScreen(beans, beansScreen);

                        break;

                    case "CornDodgers":
                        var dodgers       = new CornDodgers();
                        var dodgersScreen = new CustomizeSide();
                        AddItemAndOpenCustomizationScreen(dodgers, dodgersScreen);

                        break;

                    case "Water":
                        var water       = new Water();
                        var waterScreen = new CustomizeWater();
                        AddItemAndOpenCustomizationScreen(water, waterScreen);

                        break;

                    case "CowboyCoffee":
                        var coffee       = new CowboyCoffee();
                        var coffeeScreen = new CustomizeCowboyCoffee();
                        AddItemAndOpenCustomizationScreen(coffee, coffeeScreen);

                        break;

                    case "TexasTea":
                        var tea       = new TexasTea();
                        var teaScreen = new CustomizeTexasTea();
                        AddItemAndOpenCustomizationScreen(tea, teaScreen);

                        break;

                    case "JerkedSoda":
                        var soda       = new JerkedSoda();
                        var sodaScreen = new CustomizeJerkedSoda();
                        AddItemAndOpenCustomizationScreen(soda, sodaScreen);

                        break;

                    default:
                        break;
                    }
                }
            }
        }
Exemplo n.º 20
0
        public void ChangingSourCreamPropertyShouldInvokePropertyChangedForSourCream()
        {
            var chili = new CowpokeChili();

            Assert.PropertyChanged(chili, "SourCream", () => { chili.SourCream = false; });
        }
Exemplo n.º 21
0
        public void DefaultPriceShouldBeCorrect()
        {
            var chili = new CowpokeChili();

            Assert.Equal(6.10, chili.Price);
        }
Exemplo n.º 22
0
        public void ChangingTortillaStripsPropertyShouldInvokePropertyChangedForTortillaStrips()
        {
            var chili = new CowpokeChili();

            Assert.PropertyChanged(chili, "TortillaStrips", () => { chili.TortillaStrips = false; });
        }
Exemplo n.º 23
0
        public void DefaultCaloriesShouldBeCorrect()
        {
            var chili = new CowpokeChili();

            Assert.Equal <uint>(171, chili.Calories);
        }
Exemplo n.º 24
0
        /// <summary>
        /// Button handler that calls the helper method depending on the item selected
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void OnItemAddButtonClicked(object sender, RoutedEventArgs e)
        {
            IOrderItem       item   = null;
            FrameworkElement screen = null;
            var orderControl        = this.FindAncestor <OrderControl>();

            if (DataContext is Order order)
            {
                if (sender is Button button)
                {
                    switch (button.Tag)
                    {
                    case "CowpokeChili":
                        item   = new CowpokeChili();
                        screen = new CustomizeCowpokeChili();
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;

                    case "RustlersRibs":
                        item = new RustlersRibs();
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;

                    case "PecosPulledPork":
                        item   = new PecosPulledPork();
                        screen = new CustomizePecosPulledPork();
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;

                    case "TrailBurger":
                        item   = new TrailBurger();
                        screen = new CustomizeTrailBurger();
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;

                    case "DakotaDouble":
                        item   = new DakotaDoubleBurger();
                        screen = new CustomizeDakotaDoubleBurger();
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;

                    case "TexasTriple":
                        item   = new TexasTripleBurger();
                        screen = new CustomizeTexasTripleBurger();
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;

                    case "AngryChicken":
                        item   = new AngryChicken();
                        screen = new CustomizeAngryChicken();
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;

                    case "ChiliCheeseFries":
                        item   = new ChiliCheeseFries();
                        screen = new CustomizeChiliCheeseFries();
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;

                    case "CornDodgers":
                        item   = new CornDodgers();
                        screen = new CustomizeCornDodgers();
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;

                    case "PanDeCampo":
                        item   = new PanDeCampo();
                        screen = new CustomizePanDeCampo();
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;

                    case "BakedBeans":
                        item   = new BakedBeans();
                        screen = new CustomizeBakedBeans();
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;

                    case "JerkedSoda":
                        item   = new JerkedSoda();
                        screen = new CustomizeJerkedSoda();
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;

                    case "TexasTea":
                        item   = new TexasTea();
                        screen = new CustomizeTexasTea();
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;

                    case "CowboyCoffee":
                        item   = new CowboyCoffee();
                        screen = new CustomizeCowboyCoffee();
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;

                    case "Water":
                        item   = new Water();
                        screen = new CustomizeWater();
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;

                    default:
                        AddItemAndOpenCustomizationScreen(item, screen);
                        break;
                    }
                }
            }
        }