public void DisposesTheHandleDuringDispose() { var target = new DefaultRasDialCallbackHandler(rasHangUp.Object, rasEnumConnections.Object, exceptionPolicy.Object, waitHandle.Object); target.Dispose(); waitHandle.Verify(o => o.Dispose(), Times.Once); }
public void DisposesTheHandleDuringDispose() { var rasHangUp = new Mock <IRasHangUp>(); var rasEnumConnections = new Mock <IRasEnumConnections>(); var exceptionPolicy = new Mock <IExceptionPolicy>(); var waitHandle = new Mock <IValueWaiter <IntPtr> >(); var cancellationSourceFactory = new Mock <ITaskCancellationSourceFactory>(); var target = new DefaultRasDialCallbackHandler(rasHangUp.Object, rasEnumConnections.Object, exceptionPolicy.Object, waitHandle.Object, cancellationSourceFactory.Object); target.Dispose(); waitHandle.Verify(o => o.Dispose(), Times.Once); }
public void DisposesTheCancellationSourceDuringDispose() { var rasHangUp = new Mock <IRasHangUp>(); var rasEnumConnections = new Mock <IRasEnumConnections>(); var exceptionPolicy = new Mock <IExceptionPolicy>(); var waitHandle = new Mock <IValueWaiter <IntPtr> >(); var cancellationSource = new Mock <ITaskCancellationSource>(); var cancellationSourceFactory = new Mock <ITaskCancellationSourceFactory>(); cancellationSourceFactory.Setup(o => o.Create(It.IsAny <CancellationToken>())).Returns(cancellationSource.Object); var target = new DefaultRasDialCallbackHandler(rasHangUp.Object, rasEnumConnections.Object, exceptionPolicy.Object, waitHandle.Object, cancellationSourceFactory.Object); target.Initialize(new Mock <ITaskCompletionSource <RasConnection> >().Object, e => { }, () => { }, CancellationToken.None); target.Dispose(); cancellationSource.Verify(o => o.Dispose(), Times.Once); }