private static int SearchIndex(Options o, string index) { var search = new Search(o.Url); int total = 0; try { search.SearchAndAnalyze(o.Url, index, "one passenger record", response => { foreach (var hit in response.Hits) { var mismatch = new PaxDocumentParser().FindPassengerNameMismatch(hit.Source); if (!string.IsNullOrEmpty(mismatch.Item2)) { total++; Logger.Error($"|Mismatch found: [{mismatch.Item1}, {mismatch.Item2}]|{mismatch.Item3}|{mismatch.Item4}"); new FileWriter(index).Write(hit.Id, hit.Source.Message); } } }); } catch (Exception e) { Logger.Error(e); } return(total); }
public void Must_Return_True_On_Names_Mixup() { var parser = new PaxDocumentParser(); using (var stream = File.OpenText("mixed-names-message.txt")) { var text = stream.ReadToEnd(); var @event = new logevent { Timestamp = DateTime.Now.ToString(), CorrelationId = Guid.Empty.ToString(), Message = text }; parser.FindPassengerNameMismatch(@event).Item2.Should().Be("MGEE"); } }