Ejemplo n.º 1
0
        public void ServiceTest()
        {
            var service  = new ConvertServices();
            var output   = service.ConvertVTT(vtt);
            var expected = @"WEBVTT   KEVIN PORTTEUS: Equality was the first and most  fundamental tenet of the Founders'  understanding of the laws of nature and of nature's god.  But they had a very particular way  of understanding what equality meant.  It did not mean equality of outcome.  It didn't really even mean equality of opportunity.  Equality only meant that human beings  were equal in their rights and duties under the natural law.  And that allowed for great inequality in other respects.  [MUSIC PLAYING] ";

            output.Should().Be(expected);
        }
Ejemplo n.º 2
0
        public ActionResult Create([Bind("Name,Script")] PowerShellViewModel newScript)
        {
            if (ScriptIO.ScriptExists(newScript.Name)) //TODO: Ensure this works on ViewModel - Having Issues - 11/16/2015
            {
                ModelState.AddModelError("Name", "This Name Already Exists");
                return(View(newScript));
            }
            var script = ConvertServices.CreateScript(newScript, User.Identity.Name);

            if (TryValidateModel(script))
            {
                //Write File and Save Metadata
                if (ScriptIO.Write(newScript.Name, newScript.Script))
                {
                    //Save PowerShell Script
                    _scriptRepository.InsertScript(script);
                    _scriptRepository.Save();
                    //TODO: return RedirectToAction("Details", new { id = psScript.Id });
                    return(RedirectToAction("Index"));
                }
            }
            return(View(newScript));
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            int          yourChoice = 0;
            bool         checkInput;
            Shop         coffeShop         = new Shop();
            ShopServices coffeShopServices = new ShopServices(ref coffeShop);

            while (true)
            {
backToMainMenu:
                MenuProgramServices.DisplayMainMenu();
                do
                {
                    Console.Write("Your option: ");
                    checkInput = ConvertServices.ToIntByTryParse(Console.ReadLine(), out yourChoice);
                } while (!checkInput || yourChoice <= 0 || yourChoice > 6);
                switch (yourChoice)
                {
                    #region Add more tables
                case 1:
                    int numberTableToCreate;
                    Console.WriteLine($"Shop now have {coffeShop.ListTables.Count} tables (maximum is 50)");
                    do
                    {
                        Console.Write("Please enter number of tables you want to add(max 20): ");
                        checkInput = ConvertServices.ToIntByTryParse(Console.ReadLine(), out numberTableToCreate);
                    } while (!checkInput || numberTableToCreate < 0 || numberTableToCreate > 20);
                    if (numberTableToCreate + coffeShop.ListTables.Count > 50)
                    {
                        Console.WriteLine("Your shop can't have to much tables");
                        goto backToMainMenu;     //Back to main menu
                    }
                    coffeShopServices.AddMoreTable(numberTableToCreate);
                    break;

                    #endregion
                    #region Add Item to Menu of Shop
                case 2:
backToMenuAddItem:
                    MenuProgramServices.DisplayMenuCreateItem();
                    do
                    {
                        Console.Write("Your Option: ");
                        checkInput = ConvertServices.ToIntByTryParse(Console.ReadLine(), out yourChoice);
                    } while (!checkInput || yourChoice <= 0 || yourChoice > 3);
                    if (yourChoice == 3)
                    {
                        goto backToMenuAddItem;
                    }
                    coffeShopServices.AddItemToMenuShop();
                    string choiceContinue = string.Empty;
                    do
                    {
                        Console.Write("Do you want add more item? (Y/N): ");
                        choiceContinue = Console.ReadLine().Trim();
                    } while (choiceContinue != "Y" && choiceContinue != "y" && choiceContinue != "Y" && choiceContinue != "n");
                    if (choiceContinue == "Y" || choiceContinue == "y")
                    {
                        goto backToMenuAddItem;
                    }
                    break;

                    #endregion
                    #region Order
                case 3:
                    if (coffeShopServices.CanMakeOrder())
                    {
                        Console.WriteLine("Shop have no table or menu is empty to order");
                        goto backToMainMenu;
                    }
                    else
                    {
                        coffeShopServices.DisplayProductsMenu();
                        int id, qty, tableNumber;
                        if (!coffeShopServices.InputDataOrder(out id, out qty, out tableNumber))
                        {
                            goto backToMainMenu;
                        }
                        ItemOfMenu itemOrder  = null;
                        Table      tableOrder = null;
                        if (coffeShopServices.GetItemById(id) != null)
                        {
                            itemOrder = coffeShopServices.GetItemById(id);
                        }
                        if (coffeShopServices.GetTable(tableNumber) != null)
                        {
                            tableOrder = coffeShopServices.GetTable(tableNumber);
                        }
                        if (itemOrder != null && tableOrder != null)
                        {
                            coffeShopServices.OrderDrinksOrFoods(itemOrder, tableOrder, qty);
                            Console.Write("Your order has success\n");
                        }
                        else
                        {
                            Console.WriteLine("Please check again your input");
                        }
                    }
                    break;

                    #endregion
                    #region Create Payment
                case 4:
                    int tableNumberCheckout = -1;
                    Console.WriteLine("Enter 0 for back to main Program");
                    do
                    {
                        Console.Write("Please enter table number to create payment: ");
                        checkInput = ConvertServices.ToIntByTryParse(Console.ReadLine(), out tableNumberCheckout);
                    } while (!checkInput);
                    if (tableNumberCheckout == 0)
                    {
                        goto backToMainMenu;
                    }
                    coffeShopServices.CreateBill(tableNumberCheckout);
                    coffeShopServices.ChangeTableStatus(tableNumberCheckout);
                    break;

                    #endregion
                case 5:
                    coffeShopServices.ShowTablesFree();
                    break;

                case 6:
                    Environment.Exit(0);
                    break;
                }
            }
        }