private void MenuFind()
        {
            try
            {
                var objVehicle = MenuWriter.Find();
                var obj        = _services.Find($"{objVehicle.ChassisSeries}-{objVehicle.ChassisNumber}");
                if (obj != null)
                {
                    List <IVehicle> listVehicle = new List <IVehicle>();
                    listVehicle.Add(obj);
                    MenuWriter.ListAll(listVehicle);
                }
                else
                {
                    MenuWriter.ListAll(null);
                }

                MainMenu();
            }
            catch (DomainException ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine($"[ERROR] - {ex.Message}");
                Console.ResetColor();
                MainMenu();
            }
        }
Example #2
0
        public void ActivateDeActivateWorkerTest_ValidX(string request)
        {
            MenuWriter mw = new MenuWriter();

            bool actual = mw.ActivateDeActivateWorker(request);

            Assert.AreEqual(true, actual);
        }
Example #3
0
        public void RequestStartServerTest_ValidYES(string yes)
        {
            MenuWriter mw       = new MenuWriter();
            bool       expected = true;
            bool       actual   = mw.RequestStartServer(yes.ToUpper());

            Assert.AreEqual(expected, actual);
        }
Example #4
0
        public void CheckWriterInputRequestTest_ValidParameterYES(string yesOrNo)
        {
            MenuWriter mw       = new MenuWriter();
            bool       expected = true;
            bool       actual   = mw.CheckWriterInputRequest(yesOrNo);

            Assert.AreEqual(expected, actual);
        }
Example #5
0
        public void RequestStartServerTest_ValidNO(string no)
        {
            MenuWriter mw       = new MenuWriter();
            bool       expected = false;
            bool       actual   = mw.RequestStartServer(no.ToUpper());

            Assert.AreEqual(expected, actual);
        }
Example #6
0
        public void ActivateDeActivateWorkerTest_ValidDot(string request)
        {
            MenuWriter mw = new MenuWriter();

            mockAddRemoveWorker.Setup(m => m.ReturnNumberOfWorkers()).Returns(0);
            bool actual = mw.ActivateDeActivateWorker(request);

            Assert.AreEqual(true, actual);
        }
Example #7
0
        public void RequestStartServerTest_Invalid(string fail)
        {
            MenuWriter mw = new MenuWriter();

            Assert.Throws <ArgumentException>(() =>
            {
                mw.RequestStartServer(fail);
            });
        }
Example #8
0
        public void CheckWriterInputRequestTest_InvalidParameter(string yesOrNo)
        {
            MenuWriter mw = new MenuWriter();

            Assert.Throws <ArgumentException>(() =>
            {
                mw.CheckWriterInputRequest(yesOrNo);
            });
        }
Example #9
0
        public void ActivateDeActivateWorkerTest_InvalidInput(string request)
        {
            MenuWriter mw = new MenuWriter();

            Assert.Throws <ArgumentException>(() =>
            {
                mw.ActivateDeActivateWorker(request);
            });
        }
Example #10
0
        public void ActivateDeActivateWorkerTest_ValidNo(string request)
        {
            MenuWriter mw = new MenuWriter();

            mockAddRemoveWorker.Setup(m => m.RemoveWorker()).Returns(false);
            bool actual = mw.ActivateDeActivateWorker(request);

            Assert.AreEqual(false, actual);
        }
Example #11
0
		public void ShowPage(string title, MenuWriter menu, BodyWriter body)
		{
			Write("<table cellspacing='0' width='100%' height='100%' cellpadding='4' border='0'>");
			Write("<tr><td colspan='2' class='GenericPageTitle'>" + Escape(title, true) + "</td></tr>");
			Write("<tr><td class='GenericPageMenuColumn' valign=top>");
			menu();
			Write("</td><td width='100%' height='100%' valign=top>");
			body();
			Write("</td></tr></table>");
		}
Example #12
0
 private void MenuExit()
 {
     if (MenuWriter.Exit())
     {
         Environment.Exit(0);
     }
     else
     {
         MainMenu();
     }
 }
Example #13
0
        public void MenuWriter_ValidInputTest(string s1, string s2, string s3)
        {
            MenuWriter mw = new MenuWriter();

            mw.StartServer       = s1;
            mw.StatusWorker      = s2;
            mw.PreuzmiOdKlijenta = s3;

            Assert.AreEqual(mw.StartServer, s1);
            Assert.AreEqual(mw.StatusWorker, s2);
            Assert.AreEqual(mw.PreuzmiOdKlijenta, s3);
        }
Example #14
0
        /// <summary>
        /// Responsible for rendering the DNNMenu and in an uplevel rendering of the Menu, sending down the xml for the child nodes in a ClientAPI variable.
        /// </summary>
        /// <param name="writer"></param>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [Jon Henning]	5/6/2005	Created
        ///		[Jon Henning 4/6/2005	Commented
        /// </history>
        protected override void Render(HtmlTextWriter writer)
        {
            MenuWriter.RenderMenu(writer, this);
            //added back...??? not sure if this is ok... - urllist needs it
            //If Me.IsDownLevel = False Then DotNetNuke.UI.Utilities.ClientAPI.RegisterClientVariable(Me.Page, Me.ClientID & "_xml", Me.MenuNodes.ToXml, True)
            Control oCtl;

            foreach (Control tempLoopVar_oCtl in this.Controls)
            {
                oCtl = tempLoopVar_oCtl;
                oCtl.RenderControl(writer);
            }
        }
Example #15
0
        public void MainMenu()
        {
            MenuWriter.MainMenu();

            try
            {
                Int32.TryParse(Console.ReadLine(), out int option);
                MenuOption menu = (MenuOption)option;

                switch (menu)
                {
                case MenuOption.Insert:
                    MenuInsert();
                    break;

                case MenuOption.Update:
                    MenuUpdate();
                    break;

                case MenuOption.Delete:
                    MenuDelete();
                    break;

                case MenuOption.ListAll:
                    MenuListAll();
                    break;

                case MenuOption.Find:
                    MenuFind();
                    break;

                case MenuOption.Exit:
                    MenuExit();
                    break;

                default:
                    Console.ForegroundColor = ConsoleColor.Red;
                    Console.WriteLine($"[ERROR] - Invalid option, please choose one of the options below.");
                    Console.ResetColor();
                    MainMenu();
                    break;
                }
            }
            catch (Exception)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine($"[ERROR] - Invalid option, please choose one of the options below.");
                Console.ResetColor();
                MainMenu();
            }
        }
Example #16
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Responsible for rendering the DNNMenu and in an uplevel rendering of the Menu, sending down the xml for the child nodes in a ClientAPI variable.
        /// </summary>
        /// <param name="writer"></param>
        /// <remarks>
        /// </remarks>
        /// <history>
        ///     [Jon Henning]	5/6/2005	Created
        ///		[Jon Henning 4/6/2005	Commented
        /// </history>
        /// -----------------------------------------------------------------------------
        protected override void Render(HtmlTextWriter writer)
        {
            MenuWriter.RenderMenu(writer, this);
            //added back...??? not sure if this is ok... - urllist needs it
            //If Me.IsDownLevel = False Then DotNetNuke.UI.Utilities.ClientAPI.RegisterClientVariable(Me.Page, Me.ClientID & "_xml", Me.MenuNodes.ToXml, True)
            foreach (Control oCtl in this.Controls)
            {
                oCtl.RenderControl(writer);
            }

            if (IsDownLevel == false)
            {
                ClientAPI.RegisterStartUpScript(this.Page, this.ClientID + "_startup", "<script>dnn.controls.initMenu($('" + this.ClientID + "'));</script>");
            }
        }
Example #17
0
 private void MenuUpdate()
 {
     try
     {
         var objVehicle = MenuWriter.Update();
         _services.Update($"{objVehicle.ChassisSeries}-{objVehicle.ChassisNumber}", objVehicle.Color);
         MainMenu();
     }
     catch (DomainException ex)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine($"[ERROR] - {ex.Message}");
         Console.ResetColor();
         MainMenu();
     }
 }
Example #18
0
 private void MenuInsert()
 {
     try
     {
         var objvehicle = MenuWriter.Insert();
         _services.Insert(objvehicle.ChassisSeries, objvehicle.ChassisNumber, objvehicle.TypeVehicle, objvehicle.Color);
         MainMenu();
     }
     catch (DomainException ex)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine($"[ERROR] - {ex.Message}");
         Console.ResetColor();
         MainMenu();
     }
 }
Example #19
0
 private void MenuListAll()
 {
     try
     {
         List <IVehicle> listVehicles = _services.ListAll();
         MenuWriter.ListAll(listVehicles);
         MainMenu();
     }
     catch (DomainException ex)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine($"[ERROR] - {ex.Message}");
         Console.ResetColor();
         MainMenu();
     }
 }
Example #20
0
        public void StartServerMenuTest_Valid()
        {
            MenuWriter mw     = new MenuWriter();
            var        output = new StringWriter();

            Console.SetOut(output);


            var input = new StringReader("Y");

            Console.SetIn(input);
            mw.StartServerMenu();


            Assert.That(output.ToString() + "Y", Is.EqualTo(("1. Start sending data to Server[Y/N]" + Environment.NewLine + "Y")));
        }
Example #21
0
        public void PrintMenuTest_Valid()
        {
            MenuWriter mw     = new MenuWriter();
            var        output = new StringWriter();

            Console.SetOut(output);

            var input = new StringReader("+");

            Console.SetIn(input);
            mw.PrintMenu();

            Assert.That(output.ToString() + "+", Is.EqualTo((@"
            Enter Command: + for add worker
                           - for delete worker
                           . for number of active workers
                           x for application exit" + Environment.NewLine + "+")));
        }