Exemplo n.º 1
0
 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.");
 }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
        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);
        }