public void Dispose_DisposeHasNotBeenInvoked_InvokesAction() { var action = Substitute.For <Action>(); var uut = new DisposeInvoker(action); uut.Dispose(); action.Received(1).Invoke(); }
public void Dispose_DisposeHasBeenInvoked_InvokesAction() { var action = Substitute.For <Action>(); var uut = new DisposeInvoker(action); uut.Dispose(); action.ClearReceivedCalls(); uut.Dispose(); action.DidNotReceive().Invoke(); }
public override void CloseDW(uint dwReserved) { if(iContextMenu2 != null) { Marshal.ReleaseComObject(iContextMenu2); iContextMenu2 = null; } if(this.folderView != null) { Marshal.ReleaseComObject(this.folderView); this.folderView = null; } if(this.shellBrowser != null) { Marshal.ReleaseComObject(this.shellBrowser); this.shellBrowser = null; } DisposeInvoker method = new DisposeInvoker(this.InvokeDispose); if(this.thumbnailTooltip != null) { this.thumbnailTooltip.Invoke(method, new object[] { this.thumbnailTooltip }); this.thumbnailTooltip = null; } if(this.subDirTip != null) { this.subDirTip.Invoke(method, new object[] { this.subDirTip }); this.subDirTip = null; } if(this.hashForm != null) { this.hashForm.Invoke(method, new object[] { this.hashForm }); this.hashForm = null; } if(this.hHook_MsgDesktop != IntPtr.Zero) { PInvoke.UnhookWindowsHookEx(this.hHook_MsgDesktop); this.hHook_MsgDesktop = IntPtr.Zero; } if(this.hHook_MsgShell_TrayWnd != IntPtr.Zero) { PInvoke.UnhookWindowsHookEx(this.hHook_MsgShell_TrayWnd); this.hHook_MsgShell_TrayWnd = IntPtr.Zero; } if(this.hHook_KeyDesktop != IntPtr.Zero) { PInvoke.UnhookWindowsHookEx(this.hHook_KeyDesktop); this.hHook_KeyDesktop = IntPtr.Zero; } if(this.shellViewController != null) { this.shellViewController.ReleaseHandle(); this.shellViewController = null; } base.CloseDW(dwReserved); }