public void ThrowException_WhenReadPacketGotPacketItCannotHandle()
        {
            var adminPacketService = new AdminPacketService(new IPacketTransformer[0], new IMessageTransformer[0]);

            Packet packet = new Packet();

            packet.SendByte((byte)AdminMessageType.ADMIN_PACKET_SERVER_BANNED);
            packet.PrepareToSend();

            Assert.Throws <AdminPortException>(() => adminPacketService.ReadPacket(packet));
        }
        public void ReadPacket_WhenItCanCreateMessageBasedOnPacket()
        {
            var messageTransformer = new Mock <IPacketTransformer>();

            messageTransformer.SetupGet(x => x.SupportedMessageType).Returns(AdminMessageType.ADMIN_PACKET_SERVER_BANNED);
            IAdminMessage adminMessage = Mock.Of <IAdminMessage>();

            messageTransformer.Setup(x => x.Transform(It.IsAny <Packet>())).Returns(adminMessage);

            var    adminPacketService = new AdminPacketService(new IPacketTransformer[] { messageTransformer.Object }, new IMessageTransformer[0]);
            Packet packet             = new Packet();

            packet.SendByte((byte)AdminMessageType.ADMIN_PACKET_SERVER_BANNED);
            packet.PrepareToSend();

            Assert.Same(adminMessage, adminPacketService.ReadPacket(packet));
        }