Пример #1
0
        public void EncodeDecodeLoginRequest()
        {
            LoginRequest testMessage = new LoginRequest();

            Assert.AreEqual(typeof(LoginRequest), testMessage.GetType());
            Assert.IsNull(testMessage.IdentityInfo);
            byte[] encodedBytes = testMessage.Encode();
            Assert.IsNotNull(encodedBytes);
            Message decodedMessage = Message.Decode(encodedBytes);

            Assert.IsNotNull(decodedMessage);
            Assert.AreEqual(typeof(LoginRequest), decodedMessage.GetType());

            testMessage = new LoginRequest();
            Assert.IsNull(testMessage.IdentityInfo);
            testMessage.IdentityInfo = new Common.Users.User();
            Assert.AreEqual(typeof(LoginRequest), testMessage.GetType());
            Assert.IsNotNull(testMessage.IdentityInfo);
            encodedBytes = testMessage.Encode();
            Assert.IsNotNull(encodedBytes);
            decodedMessage = Message.Decode(encodedBytes);
            Assert.IsNotNull(decodedMessage);
            Assert.IsNotNull(((LoginRequest)decodedMessage).IdentityInfo);
            Assert.AreEqual(typeof(LoginRequest), decodedMessage.GetType());
        }