public void TestMemberListExport() { MemberListExport mle = new MemberListExport(); mle.ProgressChanged += delegate(object o, ProgressChangedEventArgs pcea) { if (pcea.ProgressPercentage == 100) _exportCompleted = true; }; mle.Members = _handler.Database.MemberSet.AsEnumerable(); mle.OutputPath = _testOutputName; mle.Export(); Assert.IsTrue(_exportCompleted); }
public void TestAllExportsCompletedEventIsReported() { AutoResetEvent evt = new AutoResetEvent(false); bool _allExportsDone = false; IExportService es = new ExportService(Dispatcher.CurrentDispatcher); MemberListExport mle = new MemberListExport(); mle.Members = _handler.Database.MemberSet.AsEnumerable(); mle.OutputPath = _testOutputName; Assert.IsFalse(es.ExportInProgress); es.AllExportsCompleted += delegate { _allExportsDone = true; evt.Set(); }; es.QueueExportJob(mle); DispatcherUtil.DoEventsUntil(evt); Assert.IsTrue(_allExportsDone); }