コード例 #1
0
        public void ParseInvalidStringToBinaryFrameTest()
        {
            string match = "a \r";
            UTF8Encoding encoder = new UTF8Encoding();
            var buffer = encoder.GetBytes(match);
            BinaryFrame frame = new BinaryFrame();
            ArgumentException exp = null;
            try
            {
                BinaryFrame result = frame.GetFrame(buffer) as BinaryFrame;
            }
            catch (Exception ex)
            {
                if (ex is ArgumentException)
                    exp = ex as ArgumentException;
            }

            Assert.AreEqual(exp.Message, "buffer does not match frame type");
        }
コード例 #2
0
 public void ParseOneToBinaryFrameTest()
 {
     string match = "1 \r";
     UTF8Encoding encoder = new UTF8Encoding();
     var buffer = encoder.GetBytes(match);
     BinaryFrame frame = new BinaryFrame();
     BinaryFrame result = frame.GetFrame(buffer) as BinaryFrame;
     Assert.AreEqual(true, result.CurrentValue);
 }