Ejemplo n.º 1
0
        public void WriteCloseConnectionRequest()
        {
            IProtocolFormatter aProtocolFormater = new EneterProtocolFormatter();

            byte[] anCloseConnectionMessage = (byte[])aProtocolFormater.EncodeCloseConnectionMessage("ResponseReceiver_1");

            ProtocolMessage aProtocolMessage = aProtocolFormater.DecodeMessage(new MemoryStream(anCloseConnectionMessage));

            Assert.AreEqual(EProtocolMessageType.CloseConnectionRequest, aProtocolMessage.MessageType);
            Assert.AreEqual("ResponseReceiver_1", aProtocolMessage.ResponseReceiverId);
            Assert.IsNull(aProtocolMessage.Message);
        }
Ejemplo n.º 2
0
        public void WriteRequestMessage()
        {
            IProtocolFormatter aProtocolFormater = new EneterProtocolFormatter();

            String aMessage = "Hello";

            byte[] aRequestMessage = (byte[])aProtocolFormater.EncodeMessage("ResponseReceiver_1", aMessage);

            ProtocolMessage aProtocolMessage = aProtocolFormater.DecodeMessage(new MemoryStream(aRequestMessage));

            Assert.AreEqual(EProtocolMessageType.MessageReceived, aProtocolMessage.MessageType);
            Assert.AreEqual("ResponseReceiver_1", aProtocolMessage.ResponseReceiverId);
            Assert.AreEqual(aMessage, aProtocolMessage.Message);
        }