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(); } }
public void ActivateDeActivateWorkerTest_ValidX(string request) { MenuWriter mw = new MenuWriter(); bool actual = mw.ActivateDeActivateWorker(request); Assert.AreEqual(true, actual); }
public void RequestStartServerTest_ValidYES(string yes) { MenuWriter mw = new MenuWriter(); bool expected = true; bool actual = mw.RequestStartServer(yes.ToUpper()); Assert.AreEqual(expected, actual); }
public void CheckWriterInputRequestTest_ValidParameterYES(string yesOrNo) { MenuWriter mw = new MenuWriter(); bool expected = true; bool actual = mw.CheckWriterInputRequest(yesOrNo); Assert.AreEqual(expected, actual); }
public void RequestStartServerTest_ValidNO(string no) { MenuWriter mw = new MenuWriter(); bool expected = false; bool actual = mw.RequestStartServer(no.ToUpper()); Assert.AreEqual(expected, actual); }
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); }
public void RequestStartServerTest_Invalid(string fail) { MenuWriter mw = new MenuWriter(); Assert.Throws <ArgumentException>(() => { mw.RequestStartServer(fail); }); }
public void CheckWriterInputRequestTest_InvalidParameter(string yesOrNo) { MenuWriter mw = new MenuWriter(); Assert.Throws <ArgumentException>(() => { mw.CheckWriterInputRequest(yesOrNo); }); }
public void ActivateDeActivateWorkerTest_InvalidInput(string request) { MenuWriter mw = new MenuWriter(); Assert.Throws <ArgumentException>(() => { mw.ActivateDeActivateWorker(request); }); }
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); }
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>"); }
private void MenuExit() { if (MenuWriter.Exit()) { Environment.Exit(0); } else { MainMenu(); } }
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); }
/// <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); } }
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(); } }
/// ----------------------------------------------------------------------------- /// <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>"); } }
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(); } }
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(); } }
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(); } }
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"))); }
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 + "+"))); }