public void CanExtend_CalledAfterDisposed_Throws() { HotSpotProvider hotSpotProvider = new HotSpotProvider(); hotSpotProvider.Dispose(); using (TextBox textBox = new TextBox()) { Assert.Throws<ObjectDisposedException>(() => hotSpotProvider.CanExtend(textBox)); } }
public void SetSite_CalledAfterDisposed_Throws() { HotSpotProvider hotSpotProvider = new HotSpotProvider(); hotSpotProvider.Dispose(); Assert.Throws<ObjectDisposedException>(() => hotSpotProvider.Site = null); }
public void GetSite_CalledAfterDisposed_Throws() { HotSpotProvider hotSpotProvider = new HotSpotProvider(); hotSpotProvider.Dispose(); ISite x; Assert.Throws<ObjectDisposedException>(() => x = hotSpotProvider.Site); }
public void Dispose_CalledTwice_CallsHandlerOnce() { HotSpotProvider hotSpotProvider = new HotSpotProvider(); int disposedCalledCount = 0; hotSpotProvider.Disposed += delegate { ++disposedCalledCount; }; Assert.AreEqual(0, disposedCalledCount); hotSpotProvider.Dispose(); Assert.AreEqual(1, disposedCalledCount); hotSpotProvider.Dispose(); Assert.AreEqual(1, disposedCalledCount); }
public void Dispose_HasDisposedEventHandler_CallsHandler() { HotSpotProvider hotSpotProvider = new HotSpotProvider(); bool disposedCalled = false; hotSpotProvider.Disposed += delegate { disposedCalled = true; }; Assert.IsFalse(disposedCalled); hotSpotProvider.Dispose(); Assert.IsTrue(disposedCalled); }
public void SetEnableHotSpots_CalledAfterDisposed_Throws() { HotSpotProvider hotSpotProvider = new HotSpotProvider(); hotSpotProvider.Dispose(); using (TextBox textBox = new TextBox()) { Assert.Throws<ObjectDisposedException>(() => hotSpotProvider.SetEnableHotSpots(textBox, false)); } }