public void ReadFrame_AVERROR_EOF_ReturnsFalse() { var ffmpegMock = new Mock <FFmpegClient>(); ffmpegMock .Setup(c => c.ReadFrame(It.IsAny <AVFormatContext>(), It.IsAny <AVPacket>())) .Returns(NativeFFmpeg.AVERROR_EOF) .Verifiable(); var ffmpegClient = ffmpegMock.Object; using (var packet = new AVPacket(ffmpegClient)) { Assert.False(packet.ReadFrame(new AVFormatContext())); } ffmpegMock.Verify(); }
public void ReadFrame_ReadsFrame() { var ffmpegMock = new Mock <FFmpegClient>(); ffmpegMock .Setup(c => c.ReadFrame(It.IsAny <AVFormatContext>(), It.IsAny <AVPacket>())) .Returns(0) .Verifiable(); var ffmpegClient = ffmpegMock.Object; using (var packet = new AVPacket(ffmpegClient)) { Assert.True(packet.ReadFrame(new AVFormatContext())); } ffmpegMock.Verify(); }
public void ReadFrame_AVError_Throws() { var ffmpegMock = new Mock <FFmpegClient>(); ffmpegMock .Setup(c => c.ReadFrame(It.IsAny <AVFormatContext>(), It.IsAny <AVPacket>())) .Returns(-100) .Verifiable(); ffmpegMock .Setup(c => c.ThrowOnAVError(-100, false)) .Verifiable(); var ffmpegClient = ffmpegMock.Object; using (var packet = new AVPacket(ffmpegClient)) { Assert.False(packet.ReadFrame(new AVFormatContext())); } ffmpegMock.Verify(); }