public void GetAcceptLoginPackageTest()
        {
            var data = _acceptLoginPackage.ToByteArray();

            ServerPackage package = _factory.GetNextPackage(data);

            Assert.NotNull(package);
            Assert.AreEqual(data, package.ToByteArray());
            Assert.AreEqual(_acceptLoginPackage.Type, package.Type);
            Assert.AreEqual(_acceptLoginPackage.ClientId, ((AcceptLoginPackage)package).ClientId);
        }
        public void AcceptLoginPackageDeserializationTest()
        {
            var buffer = _expected.ToByteArray();

            AcceptLoginPackage actual      = new AcceptLoginPackage();
            ServerPackageType  packageType = ServerPackageType.None;

            using (var stream = new MemoryStream(buffer))
            {
                using (var reader = new BinaryReader(stream))
                {
                    var len = reader.ReadInt32();
                    packageType = (ServerPackageType)reader.ReadByte();
                    actual.FromByteArray(reader.ReadBytes(len - 1));
                }
            }

            Assert.AreEqual(_expected.Type, packageType);
            Assert.AreEqual(_expected.ClientId, actual.ClientId);
        }