Ejemplo n.º 1
0
        //IPXProtocolFeedbackReceiver

        public void ReceivedMessage(byte[] message)
        {
            try {
                this.context.Handlers().HandleMessage(
                    encoder.DecodeMessage(LogData(message, "Message received: {0}")),
                    this.MessageContextProvider
                    );
            } catch (Exception e) {
                this.context.Errors().Handle(e, PXErrorHandlingService.Scope.SocketClientMessage);
            }
        }
Ejemplo n.º 2
0
        public void MessagePassingTest()
        {
            var encoder = new PXMessageEncoder(new Type[] { typeof(TestMessages.TestMessageType1) });
            var message = TestMessages.TestMessageType1Sample1();

            Assert.AreEqual(encoder.DecodeMessage(encoder.EncodeMessage(message)), message);
        }
Ejemplo n.º 3
0
        public void FailPassingUnregisteredMessageTest()
        {
            var encoder = new PXMessageEncoder(new Type[] {});
            var message = TestMessages.TestMessageType1Sample1();

            PXUnregisteredMessageReceived received = Assert.Throws <PXUnregisteredMessageReceived>(delegate {
                encoder.DecodeMessage(encoder.EncodeMessage(message));
            });

            Assert.AreEqual(received.Message, $"Unregistered message with hash 155806286 received");
        }