public void AbleToAddAwaitingForTransportTicket() { using (var client = new DpaClient(dpaHostUrl)) { client.Login(login, password); var service = new DpaTicketService(client); service.AddAwaitingForTransportTicket(equipmentName); } }
public static DpaClient LogIn(string serverAddress, string userName, string password) { var client = new DpaClient(serverAddress); if (!client.Login(userName, password)) { client = null; } return(client); }
public void AbleToGetEquipmentByName() { using (var client = new DpaClient(dpaHostUrl)) { client.Login(login, password); var service = new DpaTicketService(client); var equipmentId = service.GetEquipmentByName(equipmentName); Assert.AreEqual(expectedEquipmentId, equipmentId); } }
public void AbleToGetTicketByName() { using (var client = new DpaClient(dpaHostUrl)) { client.Login(login, password); var service = new DpaTicketService(client); var ticketWasFound = service.TryGetTicketByName(ticketName, out var ticketId); Assert.IsTrue(ticketWasFound); Assert.AreEqual(expectedTicketId, ticketId); } }
public MenuExplorer(Menu menu) { logInMenuItem = new CommandMenuItem <string, string, string, bool>("Log in", (server, user, password) => { dpaClient = AuthMenuBuilder.LogIn(server, user, password); return(dpaClient != null); }, new CommandParameter <string>("server"), new CommandParameter <string> ("user"), new CommandParameter <string> ("password")); logOutMenuItem = new CommandMenuItem <bool>("Log out", () => { dpaClient = null; return(true); }); exitMenuItem = new CommandMenuItem <bool>("Exit", () => { Environment.Exit(-1); return(true); }); mainMenuMenuItem = new CommandMenuItem <bool>("To main menu", () => { mainMenu.NavigateToMainMenu(); return(true); }); levelUpMenuItem = new CommandMenuItem <bool>("Level up", () => { mainMenu.NavigateToLevelUp(); return(true); }); loginMenu = new Menu(new SubMenuItem("root", new[] { logInMenuItem })); loginMenu.Extend(exitMenuItem); mainMenu = menu; mainMenu.Extend(new[] { mainMenuMenuItem, levelUpMenuItem, logOutMenuItem, exitMenuItem }); currentMenu = loginMenu; }