示例#1
0
        public void AcceptMessageThrowingException()
        {
            var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null);

            var endpointId = new EndpointId("id");
            var msg        = new EndpointDisconnectData
            {
                Sender = endpointId,
            };

            var endpoint = new MessageReceivingEndpoint(
                new IConvertCommunicationMessages[]
            {
                new EndpointDisconnectConverter(),
            },
                systemDiagnostics);

            endpoint.OnNewMessage +=
                (s, e) =>
            {
                throw new Exception();
            };

            Assert.DoesNotThrow(() => endpoint.AcceptMessage(msg));
        }
示例#2
0
        public void AcceptMessage()
        {
            var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null);

            var endpointId = new EndpointId("id");
            var msg        = new EndpointDisconnectData
            {
                Sender = endpointId,
            };

            var endpoint = new MessageReceivingEndpoint(
                new IConvertCommunicationMessages[]
            {
                new EndpointDisconnectConverter(),
            },
                systemDiagnostics);

            endpoint.OnNewMessage += (s, e) => Assert.IsInstanceOf(typeof(EndpointDisconnectMessage), e.Message);

            endpoint.AcceptMessage(msg);
        }