示例#1
0
 public async Task Check_FixedLengthMessageRecognizer(int length, char fillSymbol, string sendMessage, string expectedMessage)
 {
     foreach (var actEncoding in _encodings)
     {
         var testObject = new FixedLengthMessageRecognizer(actEncoding, length, fillSymbol);
         await GenericTestMethodAsync(testObject, actEncoding, sendMessage, expectedMessage);
     }
 }
示例#2
0
        public async Task Check_FixedLengthMessageRecognizer_Errors(int length, char fillSymbol, string sendMessage, Type expectedExceptionType)
        {
            foreach (var actEncoding in _encodings)
            {
                var anyException = false;
                try
                {
                    var testObject = new FixedLengthMessageRecognizer(actEncoding, length, fillSymbol);
                    await GenericTestMethodAsync(testObject, actEncoding, sendMessage, "");
                }
                catch (Exception e)
                {
                    anyException = true;
                    Assert.IsTrue(e.GetType() == expectedExceptionType, "Unexpected exception fired");
                }

                Assert.IsTrue(anyException, "No exception fired!");
            }
        }