public void DataRetrieverRetrieveFailTest() { IDataCache dataCache = new NullDataCache(); IRequestGenerator requestGenerator = new WebRequestGenerator(); ResultEventArgs<Listings> resultEventArgs = null; using (AutoResetEvent waitEvent = new AutoResetEvent(false)) { DataRetriever dataRetriever = new DataRetriever(dataCache, requestGenerator); EventHandler<ResultEventArgs<Listings>> completedHandler = (sender, res) => { resultEventArgs = res; waitEvent.Set(); }; dataRetriever.StartRetrieve(new Uri(TestUri + "bad"), completedHandler); bool signalled = waitEvent.WaitOne(Constants.WaitTimeout); Assert.IsTrue(signalled); } Assert.IsNotNull(resultEventArgs); Assert.IsFalse(resultEventArgs.ResultStatus.Success); }