private void SearchRequest(SearchRequestEvent searchRequestEvent) { searchRequestEvent.Search.SearchOptions.OrderBy = "ReferenceKey"; this.entityService.ExecuteAsyncSearchRD( this.search = searchRequestEvent.Search, response => { ReferenceDataList searchResults = response; Dictionary <string, string> combinedResults = new Dictionary <string, string>(); foreach (var rd in searchResults) { if (combinedResults.ContainsKey(rd.ReferenceKey)) { combinedResults[rd.ReferenceKey] = combinedResults[rd.ReferenceKey] + "|" + rd.Value; } else { combinedResults.Add(rd.ReferenceKey, rd.Value); } } this.ReferenceDatas = new ObservableCollection <ReferenceDataViewModel>( combinedResults.Select( x => new ReferenceDataViewModel(x.Key, x.Value, this.eventAggregator)) .OrderBy(y => y.ReferenceKey)); }, this.eventAggregator); }
public void SetUp() { _sendEndpointProviderMock = new Mock <ISendEndpointProvider>(); _rabbitMqConfigurationMock = new Mock <IOptions <RabbitMqConfiguration> >(); _sendEndpointMock = new Mock <ISendEndpoint>(); _loggerMock = new Mock <ILogger <SearchRequestEventPublisher> >(); RabbitMqConfiguration rabbitMqConfiguration = new RabbitMqConfiguration(); rabbitMqConfiguration.Host = "localhost"; rabbitMqConfiguration.Port = 15672; rabbitMqConfiguration.Username = "******"; rabbitMqConfiguration.Password = "******"; _sendEndpointProviderMock .Setup(x => x.GetSendEndpoint(It.IsAny <Uri>())) .Returns(Task.FromResult(_sendEndpointMock.Object)); _rabbitMqConfigurationMock.Setup(x => x.Value).Returns(rabbitMqConfiguration); _sendEndpointMock.Setup(x => x.Send <SearchRequestFailedEvent>(It.IsAny <SearchRequestFailed>(), It.IsAny <CancellationToken>())) .Returns(Task.FromResult(_sendEndpointMock)); _baseEvent = new FakeSearchRequestEvent() { SearchRequestKey = "key" }; _sut = new SearchRequestEventPublisher(_sendEndpointProviderMock.Object, _rabbitMqConfigurationMock.Object, _loggerMock.Object); }
public SearchRequestNotificationEvent(SearchRequestEvent baseEvent) { this.RequestId = baseEvent.RequestId; this.SearchRequestId = baseEvent.SearchRequestId; this.TimeStamp = DateTime.Now; this.SearchRequestKey = baseEvent.SearchRequestKey; }
public async Task PublishSearchRequestFailed(SearchRequestEvent baseEvent, string message) { if (baseEvent == null) { throw new ArgumentNullException(nameof(baseEvent)); } await PublishFailed(baseEvent, message); }
public SearchRequestSavedEvent(SearchRequestEvent baseEvent) { this.RequestId = baseEvent.RequestId; this.SearchRequestId = baseEvent.SearchRequestId; this.TimeStamp = DateTime.Now; this.SearchRequestKey = baseEvent.SearchRequestKey; this.Action = baseEvent.Action; }
public async Task PublishSearchRequestRejected(SearchRequestEvent baseEvent, IEnumerable <ValidationResult> reasons) { if (baseEvent == null) { throw new ArgumentNullException(nameof(baseEvent)); } await PublishRejected(baseEvent, reasons); }
public SearchRequestRejectedEvent(SearchRequestEvent baseEvent) { this.RequestId = baseEvent.RequestId; this.SearchRequestId = baseEvent.SearchRequestId; this.TimeStamp = DateTime.Now; this.SearchRequestKey = baseEvent.SearchRequestKey; this.Action = baseEvent.Action; this.ProviderProfile = baseEvent.ProviderProfile; }
private async Task PublishRejected(SearchRequestEvent baseEvent, IEnumerable <ValidationResult> reasons) { var endpoint = await _sendEndpointProvider.GetSendEndpoint(new Uri($"rabbitmq://{this._rabbitMqConfiguration.Host}:{this._rabbitMqConfiguration.Port}/{nameof(SearchRequestRejected)}_queue")); _logger.LogInformation($"SearchRequestRejected has been published to {endpoint.ToString()}"); await endpoint.Send <SearchRequestRejected>(new SearchRequestRejectedEvent(baseEvent) { Reasons = reasons }); }
private async Task PublishFailed(SearchRequestEvent baseEvent, string message) { var endpoint = await _sendEndpointProvider.GetSendEndpoint(new Uri($"rabbitmq://{this._rabbitMqConfiguration.Host}:{this._rabbitMqConfiguration.Port}/{nameof(SearchRequestFailed)}_queue")); _logger.LogInformation($"SearchRequestFailed has been published to {endpoint.ToString()}"); await endpoint.Send <SearchRequestFailed>(new SearchRequestFailedEvent(baseEvent) { Cause = message }); }
private void SearchRequest(SearchRequestEvent searchRequestEvent) { searchRequestEvent.Search.SearchOptions.OrderBy = "LastName"; this.entityService.ExecuteAsyncSearch <Person>( this.search = searchRequestEvent.Search, response => { IList <Person> searchResults = response; this.Persons = new ObservableCollection <PersonViewModel>( searchResults.Select( x => new PersonViewModel(new EntityWithETag <Person>(x, null), this.eventAggregator)) .OrderBy(y => y.Name)); }, this.eventAggregator); }