Beispiel #1
0
        public void ShouldFailToAddPublicationOnMediaDriverError()
        {
            WhenReceiveBroadcastOnMessage(ControlProtocolEvents.ON_ERROR, ErrorMessageBuffer, buffer =>
            {
                ErrorResponse.ErrorCode(ErrorCode.INVALID_CHANNEL);
                ErrorResponse.ErrorMessage("invalid channel");
                ErrorResponse.OffendingCommandCorrelationId(CORRELATION_ID);
                return(ErrorResponse.Length());
            });

            Assert.Throws(typeof(RegistrationException), () => Conductor.AddPublication(CHANNEL, STREAM_ID_1));
        }
        public void ShouldFailToClosePublicationOnMediaDriverError()
        {
            WhenReceiveBroadcastOnMessage(ControlProtocolEvents.ON_PUBLICATION_READY, PublicationReadyBuffer, (buffer) => PublicationReady.Length());

            var publication = Conductor.AddPublication(CHANNEL, STREAM_ID_1);

            WhenReceiveBroadcastOnMessage(ControlProtocolEvents.ON_ERROR, ErrorMessageBuffer, (buffer) =>
            {
                ErrorResponse.ErrorCode(ErrorCode.INVALID_CHANNEL);
                ErrorResponse.ErrorMessage("channel unknown");
                ErrorResponse.OffendingCommandCorrelationId(CLOSE_CORRELATION_ID);
                return(ErrorResponse.Length());
            });

            publication.Dispose();
        }