public void ReturnTrueIfValidMessageType(Stream outStream, BaseRequest message, IMediaPlayer mediaPlayer, RequestService sut) { mediaPlayer.CreateSnapshot(Arg.Any <int>(), Arg.Any <int>(), Arg.Any <int>(), Arg.Any <string>()).Returns(true); sut.CanHandleMessage(mediaPlayer, message, outStream).Should() .BeTrue("Because it is a valid message."); }
public void CallCreateSnapshotOnIMediaPlayer([Frozen] IMediaPlayer mediaPlayer, Stream outStream, CreateSnapshot message, RequestService sut) { mediaPlayer.CreateSnapshot(Arg.Any <int>(), Arg.Any <int>(), Arg.Any <int>(), Arg.Any <string>()).Returns(true); sut.CanHandleMessage(mediaPlayer, message, outStream); mediaPlayer.Received(1).CreateSnapshot(message.NumberOfVideoOutput, message.Width, message.Height, message.FilePath); }
private bool ExecuteResultResponse(IMediaPlayer mediaPlayer, BaseRequest message, Stream outStream) { var success = true; switch (message) { case Load m: mediaPlayer.LoadMedia(m.Type, m.FileToLoad, m.StartPosition, m.StopPosition); break; case LocalFileStreamConnect m: mediaPlayer.ConnectLocalFileStream(m.PipeName); break; case CreateSnapshot m: success = mediaPlayer.CreateSnapshot(m.NumberOfVideoOutput, m.Width, m.Height, m.FilePath); break; case GetAudioTracks _: responseService.ReturnResultResponse(outStream, message, mediaPlayer.GetAudioTracks()); return(true); case GetVideoTracks _: responseService.ReturnResultResponse(outStream, message, mediaPlayer.GetVideoTracks()); return(true); default: return(false); } responseService.ReturnResultResponse(outStream, message, success); return(true); }