public void Dispose_InvalidatesHandle([Frozen] Mock <IWebRtcDll> libraryMock, WebRtcVad vad, byte[] audio) { Assume.That(() => vad.HasSpeech(audio), Throws.Nothing); vad.Dispose(); libraryMock.Setup(l => l.Process(It.IsAny <IntPtr>(), It.IsAny <int>(), It.IsAny <byte[]>(), It.IsAny <ulong>())).Returns(-1); Assert.That(() => vad.HasSpeech(audio), Throws.InstanceOf <ObjectDisposedException>()); }
public void Dispose_OnlyCallsFreeOnce([Frozen] Mock <IWebRtcDll> libraryMock, WebRtcVad vad) { vad.Dispose(); vad.Dispose(); libraryMock.Verify(l => l.Free(It.IsAny <IntPtr>()), Times.Once); }
public void Dispose_PassesHandleToFree([Frozen] Mock <IWebRtcDll> libraryMock, [Frozen] IntPtr handle, WebRtcVad vad) { vad.Dispose(); libraryMock.Verify(l => l.Free(handle)); }