public StationView(Vessel model) : base(model.vesselName, 500, 400) { _model = model; _tab = OpenTab.None; _usils = AssemblyLoader.loadedAssemblies.ToList().Exists(la => la.dllName == "USILifeSupport"); }
public Task GetTabHistoryShouldReturnProperHypermediaLinks(Fixture fixture) => _apiHelper.InTheContextOfAWaiter( waiter => async httpClient => { // Arrange var openTabCommand = new OpenTab { Id = Guid.NewGuid(), CustomerName = "Some customer", TableNumber = waiter.ServedTables[0].Number }; var closeTabCommand = new CloseTab { TabId = openTabCommand.Id, AmountPaid = 0 }; await _fixture.SendAsync(openTabCommand); await _fixture.SendAsync(closeTabCommand); // Act var response = await httpClient.GetAsync(TabRoute("history")); // Assert var expectedLinks = new List <string> { LinkNames.Self }; var resource = await response.ShouldBeAResource <TabsContainerResource>(expectedLinks); resource.Items.ShouldAllBe(r => r.Links.Count > 0); }, fixture);
public Task OpenTabShouldReturnProperHypermediaLinks(Fixture fixture) => _apiHelper.InTheContextOfAWaiter( waiter => async httpClient => { // Arrange var openTabCommand = new OpenTab { Id = Guid.NewGuid(), CustomerName = "Some customer", TableNumber = waiter.ServedTables[0].Number }; // Act var response = await httpClient .PostAsJsonAsync(TabRoute("open"), openTabCommand); // Assert var expectedLinks = new List <string> { LinkNames.Self, LinkNames.Tab.GetTab, LinkNames.Tab.Close, LinkNames.Tab.OrderItems }; await response.ShouldBeAResource <OpenTabResource>(expectedLinks); }, fixture);
public async Task CannotOpenATabOnAnUnexistingTable(OpenTab openTabCommand) { // Arrange // We aren't setting up anything, so regardless of what tableNumber we try // the table should not exist // Act var result = await _fixture.SendAsync(openTabCommand); // Assert result.ShouldHaveErrorOfType(ErrorType.NotFound); }
private string GetOpenTabJson() { var openTab = new OpenTab { Id = _id, Waiter = _waiter, TableNumber = _tableNumber, Status = TabStatus.OrderPlaced }; return(JsonConvert.SerializeObject(openTab)); }
public void When_open_tab_command_check_event_raised() { var commandHandler = new OpenTabCommandHandler(_messageBus); var openTab = new OpenTab { AggregateId = _aggregateId, WaiterName = "Ronald", TableNumber = 65 }; commandHandler.Handle(openTab); _messageBus.Received().RaiseEvent(Arg.Any <TabOpened>()); }
public async Task <Option <Unit, Error> > OpenTabOnTable(Guid tabId, int tableNumber) { await SetupWaiterWithTable( new HireWaiter { Id = Guid.NewGuid(), ShortName = $"Waiter{Guid.NewGuid().ToString()}" }, new AddTable { Id = Guid.NewGuid(), Number = tableNumber }); var openTabCommand = new OpenTab { Id = tabId, CustomerName = $"Customer{Guid.NewGuid().ToString()}", TableNumber = tableNumber }; return(await _fixture.SendAsync(openTabCommand)); }
private void onSelectError(string File, int Line, int Col, string ErrorText) { OpenTab theTab = Editor.TheEditor.EditorContains(File); if (theTab != null) { Editor.TheEditor.SwitchToTab(theTab.getSide(), theTab.getIndex()); SourceEditor SourceEditor = Editor.TheEditor.GetTabEditor(theTab); SourceEditor.Focus(); SourceEditor.GotoLine(Line, Col); } else { MessageBox.Show("Unable to open error. Please open the source manually first and then try again.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public async Task CanOpenTab(OpenTab openTabCommand, HireWaiter hireWaiterCommand, AddTable addTableCommand) { // Arrange await _helper.SetupWaiterWithTable(hireWaiterCommand, addTableCommand); // Make sure we're trying to open a tab on the added table openTabCommand.TableNumber = addTableCommand.Number; // Act var result = await _fixture.SendAsync(openTabCommand); // Assert await _helper.AssertTabExists( openTabCommand.Id, t => t.IsOpen == true && t.WaiterName == hireWaiterCommand.ShortName && t.CustomerName == openTabCommand.CustomerName); }
public async Task CannotOpenTabWithInvalidName(Guid tabId) { // Arrange var command = new OpenTab { TabId = tabId, ClientName = null }; // Act var result = await _fixture.SendAsync(command); // Assert result.HasValue.ShouldBeFalse(); result.MatchNone(error => error .Messages .ShouldContain(Errors.Tab.InvalidClientName)); }
public void Insert(OpenTab openTab) { var existingOpenTab = Get(openTab.Id); if (existingOpenTab == null) { _logger.Debug($"Inserting new OpenTab record with Id {openTab.Id}..."); var waiterDbContext = GetWaiterDbContext(); waiterDbContext.OpenTabs.Add(new Queries.DAL.Serialized.OpenTab { Id = openTab.Id, Data = JsonConvert.SerializeObject(openTab) }); waiterDbContext.SaveChanges(); } else { _logger.Info($"Tab with id {openTab.Id} already exists in dbo.OpenTabs. Will ignore request to create another tab with same id."); } }
public async Task CannotOpenATabOnATakenTable(OpenTab openTabCommand, HireWaiter hireWaiterCommand, AddTable addTableCommand) { // Arrange await _helper.SetupWaiterWithTable(hireWaiterCommand, addTableCommand); // Make sure we're trying to open a tab on the added table openTabCommand.TableNumber = addTableCommand.Number; // Open a tab once await _fixture.SendAsync(openTabCommand); // Act // Setting a new id for the command so we don't get a conflict on the tab id openTabCommand.Id = Guid.NewGuid(); var result = await _fixture.SendAsync(openTabCommand); // Assert result.ShouldHaveErrorOfType(ErrorType.Conflict); }
public async Task CannotOpenExistingTab(OpenTab openTabCommand, HireWaiter hireWaiterCommand, AddTable addTableCommand) { // Arrange await _helper.SetupWaiterWithTable(hireWaiterCommand, addTableCommand); // Make sure we're trying to open a tab on the added table openTabCommand.TableNumber = addTableCommand.Number; // Open a tab once await _fixture.SendAsync(openTabCommand); // Act // Make sure we won't be getting a conflict on the table numbers openTabCommand.TableNumber += 10; var result = await _fixture.SendAsync(openTabCommand); // Assert result.ShouldHaveErrorOfType(ErrorType.Conflict); }
public async Task CanOpenTab(Guid tabId, string clientName) { // Arrange var command = new OpenTab { TabId = tabId, ClientName = clientName }; // Act var result = await _fixture.SendAsync(command); // Assert result.HasValue.ShouldBeTrue(); await AssertTabExists( tabId, t => t.Id == tabId && t.ClientName == clientName && t.IsOpen == true); }
public Form1() { InitializeComponent(); InitializeClipboardGroup(); InitializeFontGroup(); InitializeParagraphGroup(); InitializeViewZoomGroup(); InitializeRibbonStyleMenu(); InitializeFocusManagement(); InitializeUndoRedo(); InitializeModifiedIcon(); InitializeQatPosition(); _rdlOpened = new RecentDocumentList(Settings.Default.OpenedFiles); _rdlSaved = new RecentDocumentList(Settings.Default.SavedFiles); // Load a sample text file into the editor. this.LoadDocument(@"Readme.rtf"); // Save application settings on exit. this.FormClosed += delegate { Properties.Settings.Default.Save(); }; var openTab = new OpenTab { Owner = this, View = c1BackstageView1 }; OpenDocumentTab.Control = openTab; var saveAsTab = new SaveAsTab { Owner = this, View = c1BackstageView1 }; SaveDocumentAsTab.Control = saveAsTab; }
public async Task CanOpenTabOnARecentlyFreedTable(Guid tabId, int tableNumber) { // Arrange await _helper.OpenTabOnTable(tabId, tableNumber); await _helper.CloseTab(tabId, 1); var commandToTest = new OpenTab { Id = Guid.NewGuid(), CustomerName = "Customer", TableNumber = tableNumber }; // Act var result = await _fixture.SendAsync(commandToTest); // Assert await _helper.AssertTabExists( commandToTest.Id, t => t.IsOpen == true && t.TableNumber == tableNumber); }
// Organise Job types public DashboardPage SortTableByOpenJob() { WaitHelper.WaitForElementToBeClickable(OpenTab); OpenTab.Click(); return(new DashboardPage(driver)); }
protected override void DrawWindowContents(int windowId) { if (_highlight != null) { _highlight.SetHighlight(_highlightStart + 1 > Planetarium.GetUniversalTime(), false); } GUILayout.BeginHorizontal(); if (GUIButton.LayoutButton("Parts")) { _tab = OpenTab.Parts; } if (GUIButton.LayoutButton("Production")) { _tab = OpenTab.Production; } if (GUIButton.LayoutButton("Consumption")) { _tab = OpenTab.Consumption; } if (GUIButton.LayoutButton("Balance")) { _tab = OpenTab.Balance; } if (GUIButton.LayoutButton("Resources")) { _tab = OpenTab.Resources; } if (GUIButton.LayoutButton("Base Site")) { _tab = OpenTab.LocalBase; } GUILayout.EndHorizontal(); var prod = _model.GetProduction().ToList(); var cons = _model.GetProduction(false).ToList(); var balance = MKSLExtensions.CalcBalance(cons, prod).ToList(); GUILayout.BeginVertical(); if (_tab == OpenTab.Parts) { GUILayout.BeginVertical(); _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, false, true); foreach (var converterPart in _model.GetConverterParts()) { GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); GUILayout.Label(converterPart.partInfo.title); GUILayout.Label(""); //converterPart.FindModuleImplementing<MKSModule>().Efficiency); if (GUIButton.LayoutButton("highlight")) { converterPart.SetHighlight(true, false); } if (GUIButton.LayoutButton("unhighlight")) { converterPart.SetHighlight(false, false); } GUILayout.EndVertical(); foreach (var converter in converterPart.FindModulesImplementing <ModuleResourceConverter>()) { GUILayout.BeginVertical(); GUILayout.Label(converter.ConverterName); GUILayout.Label(converter.status); if (converter.IsActivated) { if (GUIButton.LayoutButton("deactivate")) { converter.IsActivated = false; } } else { if (GUIButton.LayoutButton("activate")) { converter.IsActivated = true; } } GUILayout.EndVertical(); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); GUILayout.EndVertical(); } if (_tab == OpenTab.Production) { GUILayout.BeginVertical(); GUILayout.Label("Production"); foreach (var product in prod) { GUILayout.BeginHorizontal(); GUILayout.Label(product.resourceName); GUILayout.Label(Math.Round(product.amount * Utilities.SECONDS_PER_DAY, 4) + " per day"); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); } if (_tab == OpenTab.Consumption) { GUILayout.BeginVertical(); GUILayout.Label("Consumption"); foreach (var product in cons) { GUILayout.BeginHorizontal(); GUILayout.Label(product.resourceName); GUILayout.Label(Math.Round(product.amount * Utilities.SECONDS_PER_DAY, 4) + " per day"); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); } if (_tab == OpenTab.Balance) { GUILayout.BeginVertical(); GUILayout.Label("Balance"); foreach (var product in balance) { GUILayout.BeginHorizontal(); GUILayout.Label(product.resourceName); GUILayout.Label(Math.Round(product.amount * Utilities.SECONDS_PER_DAY, 4) + " per day"); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); } if (_tab == OpenTab.Resources) { GUILayout.BeginVertical(); DrawResources(balance); GUILayout.EndVertical(); } if (_tab == OpenTab.LocalBase) { GUILayout.BeginVertical(); DrawLogistics(); GUILayout.EndVertical(); } GUILayout.EndVertical(); }
public StationView(Vessel model) : base(model.vesselName, 500, 400) { _model = model; _tab = OpenTab.None; }
public ActionResult Open(OpenTab command) { _dispatcher.DispatchCommand(command); return(RedirectToAction("Order", new { id = command.TableNumber })); }
public ActionResult Open(OpenTab cmd) { cmd.Id = Guid.NewGuid(); Domain.Dispatcher.SendCommand(cmd); return(RedirectToAction("Order", new { id = cmd.TableNumber })); }
public async Task <IActionResult> OpenTab([FromBody] OpenTab command) => (await Mediator.Send(command) .MapAsync(_ => ToEmptyResourceAsync <OpenTabResource>(x => x.Id = command.Id))) .Match(Ok, Error);