예제 #1
0
        public void ThenTheMessageErrorReportShouldIncludeAnExceptionReportingThatItReceivedAnIncompleteSetOfFragmentsForAMessage(int errorCallNumber)
        {
            NmeaAisMessageStreamProcessorBindings.ErrorReport call = this.OnErrorCalls[errorCallNumber];
            Assert.IsInstanceOf <ArgumentException>(call.Error);

            var e = (ArgumentException)call.Error;

            Assert.AreEqual("Received incomplete fragmented message.", e.Message);
        }
예제 #2
0
        public void ThenTheMessageErrorReportShouldIncludeAnExceptionReportingUnexpectedPaddingOnANon_TerminalMessageFragment(int errorCallNumber)
        {
            NmeaAisMessageStreamProcessorBindings.ErrorReport call = this.OnErrorCalls[errorCallNumber];
            Assert.IsInstanceOf <ArgumentException>(call.Error);

            var e = (ArgumentException)call.Error;

            Assert.AreEqual("Can only handle non-zero padding on the final message in a fragment", e.Message);
        }
        public void ThenTheMessageErrorReportShouldIncludeAnExceptionReportingThatTheExpectedExclamationMarkIsMissing(int errorCallNumber)
        {
            NmeaAisMessageStreamProcessorBindings.ErrorReport call = this.messageProcessor.OnErrorCalls[errorCallNumber];
            Assert.IsInstanceOf <ArgumentException>(call.Error);

            var e = (ArgumentException)call.Error;

            Assert.AreEqual("Invalid data. Expected '!' at sentence start", e.Message);
        }
        public void ThenTheMessageErrorReportShouldIncludeAnExceptionReportingThatTheChecksumIsMissing(int errorCallNumber)
        {
            NmeaAisMessageStreamProcessorBindings.ErrorReport call = this.messageProcessor.OnErrorCalls[errorCallNumber];
            Assert.IsInstanceOf <ArgumentException>(call.Error);

            var e = (ArgumentException)call.Error;

            Assert.AreEqual("Invalid data. Payload checksum not present - the message may have been corrupted or truncated", e.Message);
        }
        public void ThenTheMessageErrorReportShouldIncludeAnExceptionReportingThatTheMessageAppearsToBeTruncated(int errorCallNumber)
        {
            NmeaAisMessageStreamProcessorBindings.ErrorReport call = this.messageProcessor.OnErrorCalls[errorCallNumber];
            Assert.IsInstanceOf <ArgumentException>(call.Error);

            var e = (ArgumentException)call.Error;

            Assert.AreEqual("Invalid data. The message appears to be missing some characters - it may have been corrupted or truncated.", e.Message);
        }
예제 #6
0
        public void ThenTheMessageErrorReportShouldIncludeAnExceptionReportingThatItHasReceivedTwoMessageFragmentsWithTheSameGroupIdAndPosition(int errorCallNumber)
        {
            NmeaAisMessageStreamProcessorBindings.ErrorReport call = this.OnErrorCalls[errorCallNumber];
            Assert.IsInstanceOf <ArgumentException>(call.Error);

            var          e             = (ArgumentException)call.Error;
            const string expectedStart = "Already received sentence ";

            Assert.AreEqual(expectedStart, e.Message.Substring(0, expectedStart.Length));
        }
        public void ThenTheMessageErrorReportShouldIncludeAnExceptionReportingThatAnUnsupportedFieldIsPresent(int errorCallNumber)
        {
            NmeaAisMessageStreamProcessorBindings.ErrorReport call = this.messageProcessor.OnErrorCalls[errorCallNumber];
            Assert.IsInstanceOf <NotSupportedException>(call.Error);

            var          e             = (NotSupportedException)call.Error;
            const string expectedStart = "Unsupported field type:";

            Assert.AreEqual(expectedStart, e.Message.Substring(0, expectedStart.Length));
        }
예제 #8
0
 public void ThenTheMessageErrorReportShouldIncludeTheProblematicLine(int errorCallNumber, string line)
 {
     NmeaAisMessageStreamProcessorBindings.ErrorReport call = this.OnErrorCalls[errorCallNumber];
     Assert.AreEqual(line, call.Line);
 }
예제 #9
0
 public void ThenTheMessageErrorReportShouldIncludeTheLineNumber(int errorCallNumber, int lineNumber)
 {
     NmeaAisMessageStreamProcessorBindings.ErrorReport call = this.OnErrorCalls[errorCallNumber];
     Assert.AreEqual(lineNumber, call.LineNumber);
 }
예제 #10
0
 public void ThenTheMessageErrorReportShouldIncludeTheExceptionReportedByTheLineStreamParser(int errorCallNumber)
 {
     NmeaAisMessageStreamProcessorBindings.ErrorReport call = this.processorBindings.OnErrorCalls[errorCallNumber];
     Assert.AreSame(this.exceptionProvidedToProcessor, call.Error);
 }