public async Task should_handle_the_initial_state() { var harness = new InMemoryTestHarness(); _machine = new InvestigationStateMachine(new List <Provider>()); StateMachineSagaTestHarness <Investigation, InvestigationStateMachine> saga = harness.StateMachineSaga <Investigation, InvestigationStateMachine>(_machine); await harness.Start(); var searchRequestedEvent = SearchRequested.Create(new PeopleSearchRequest("test", "test", "test")); try { await harness.InputQueueSendEndpoint.Send(searchRequestedEvent); Assert.IsTrue(harness.Consumed.Select <SearchRequested>().Any(), "Message not received"); Investigation instance = saga.Created.Select(x => x.CorrelationId == searchRequestedEvent.CorrelationId) .FirstOrDefault() ?.Saga; Assert.IsNotNull(instance, "Saga instance not found"); Assert.AreEqual(instance.CurrentState, nameof(_machine.Started)); } finally { await harness.Stop(); } }
public async Task <IActionResult> Search([FromBody] PeopleSearchRequest peopleSearchRequest) { var searchRequested = SearchRequested.Create(peopleSearchRequest); await this._busControl.Publish(searchRequested); return(Accepted(PeopleSearchResponse.Create(searchRequested.CorrelationId))); }
private void TestForSearchRequested(KeyDownEventArgs args) { if (args.OnlyControl && args.Character.ToString().ToLower().Equals("e")) { Debug.WriteLine($"{nameof(GestureService)}.{nameof(SearchRequested)}"); SearchRequested?.Invoke(null, EventArgs.Empty); } }
private void SearchButton_Click(object sender, EventArgs e) { Speaker.TellUser(StringConstants.aiSearchLibraryGreeting); if (!containerPanel.Controls.Contains(Search.Instance)) { containerPanel.Controls.Add(Search.Instance); Search.Instance.Dock = DockStyle.Fill; } SearchRequested?.Invoke(this, EventArgs.Empty); Search.Instance.BringToFront(); }
public Event GetQuoteFor(SearchRequested request) { return(new OuroQuoteDeclined() { DeliveryPostCode = request.DeliveryPostCode, DesiredDeliveryDate = request.DesiredDeliveryDate, HistoricInterestRequired = request.HistoricInterestRequired, Vendor = _companyName, VendorImageUrl = _imageUri.ToString(), Ownership = request.Ownership, NumberOfWings = request.NumberOfWings, PreviouslyOwnedOuros = request.PreviouslyOwnedOuros, SearchType = request.SearchType }); }
public Event GetQuoteFor(SearchRequested request) { //Delay the results all showing up immediately in the results stream. return(Task.Delay(_timeToRespond) .ContinueWith <OuroResultFound>(t => { return new OuroResultFound() { DeliveryPostCode = request.DeliveryPostCode, DesiredDeliveryDate = request.DesiredDeliveryDate, HistoricInterestRequired = request.HistoricInterestRequired, Vendor = _companyName, VendorImageUrl = _imageUri.ToString(), ImageUrl = _imageUri.ToString(), NumberOfWings = request.NumberOfWings, Ownership = request.Ownership, PreviouslyOwnedOuros = request.PreviouslyOwnedOuros, Price = new Random().Next(0, 1000), SearchType = request.SearchType, ValueOfPreviousOuros = request.ValueOfPreviousOuros, ClickThroughUrl = new Uri("http://google.com?q=where%20is%20ouro?").ToString() }; }).Result); }
public static void RequestSearch(string query, SearchMode mode) { SearchRequested.SafeInvoke(query, mode); }
public bool RaiseSearchRequested() => IfCanRaiseEvent(Gesture.Search, () => SearchRequested?.Invoke(this, EventArgs.Empty));
public void RaiseSearchRequested() => SearchRequested?.Invoke(this, EventArgs.Empty);
public void should_return_an_instence_of_InvestigatePerson() { var sut = SearchRequested.Create(new PeopleSearchRequest("test", "test", "test")); Assert.AreNotEqual(default(Guid), sut.CorrelationId); }