示例#1
0
        public void FromByteArray_Returns_Expected_Data()
        {
            var msg = new MessageBuilder()
                      .WriteCode(MessageCode.Server.Ping)
                      .Build();

            var ex = Record.Exception(() => ServerPing.FromByteArray(msg));

            Assert.Null(ex);
        }
示例#2
0
        public void FromByteArray_Throws_MessageException_On_Code_Mismatch()
        {
            var msg = new MessageBuilder()
                      .WriteCode(MessageCode.Server.BranchLevel)
                      .WriteInteger(1)
                      .Build();

            var ex = Record.Exception(() => ServerPing.FromByteArray(msg));

            Assert.NotNull(ex);
            Assert.IsType <MessageException>(ex);
        }