private void extractEmails_Click(object sender, RoutedEventArgs e) { var dlg = new OpenFileDialog(); dlg.FileName = "Data File"; dlg.DefaultExt = ".json"; dlg.Filter = "JSON documents |*.json"; var result = dlg.ShowDialog(); if (result == true) { string filename = dlg.FileName; int ppResult; using (new SpinnyCursor()) { var processor = new PaymentProcessor2018(); var orders = processor.ParseJsonFile(filename); var dumpFilename = filename.Substring(0, filename.LastIndexOf(@"\") + 1) + "emails.csv"; processor.ExtractEmails(orders, dumpFilename); MessageBox.Show("Extracted emails"); } } }
public void TestParseVikasFile() { var file = @"c:\users\jhayward\desktop\Events.json"; var processor = new PaymentProcessor2018(); var order = processor.ParseJsonFile(file); Assert.IsTrue(order.Any()); Assert.IsFalse(order.Any(o => o.Attendees.Count > 1)); }