public void Isolation_AfterLongDelay_GivesUpAndMovesOn()
{
var browser = new BrowserStub();
string target = "http://any old web address";
var isolator = new NavigationIsolator();
isolator.Navigate(browser, target);
Assert.That(browser.NavigateTarget, Is.EqualTo(target));
var browser2 = new BrowserStub();
string target2 = "http://some other web address";
isolator.Navigate(browser2, target2);
var browser3 = new BrowserStub();
string target3 = "http://yet another web address";
isolator.Navigate(browser3, target3);
Assert.That(browser.NavigateTarget, Is.EqualTo(target), "Second navigation should not have proceeded at once");
var start = DateTime.Now;
while (DateTime.Now - start < new TimeSpan(0, 0, 0, 2, 300))
Application.DoEvents(); // allow timer to tick.
Assert.That(() => browser2.NavigateTarget, Is.EqualTo(target2), "Second navigation should have proceeded eventually");
browser2.NormalTermination(); // the second request.
Assert.That(() => browser3.NavigateTarget, Is.EqualTo(target3), "Third navigation should have proceeded when second finished");
browser3.NormalTermination(); // hopefully from the third.
Assert.That(browser3.EventHandlerCount, Is.EqualTo(0), "event handlers should be removed once last navigation completed");
}