Example #1
0
        public void Invoke()
        {
            var endpoint = new EndpointId("id");

            ICommunicationMessage storedMsg  = null;
            SendMessage           sendAction =
                (e, m, r) =>
            {
                storedMsg = m;
            };

            var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null);

            var data         = "a";
            var responseData = "b";
            KeepAliveResponseCustomDataBuilder customData =
                o =>
            {
                Assert.AreSame(data, o);
                return(responseData);
            };

            var action = new ConnectionVerificationProcessAction(endpoint, sendAction, systemDiagnostics, customData);

            var id  = new EndpointId("id");
            var msg = new ConnectionVerificationMessage(id, data);

            action.Invoke(msg);

            var responseMessage = storedMsg as ConnectionVerificationResponseMessage;

            Assert.IsNotNull(responseMessage);
            Assert.AreEqual(msg.Id, responseMessage.InResponseTo);
            Assert.AreSame(responseData, responseMessage.ResponseData);
        }
Example #2
0
        public void MessageTypeToProcess()
        {
            var         endpoint          = new EndpointId("id");
            SendMessage sendAction        = (e, m, r) => { };
            var         systemDiagnostics = new SystemDiagnostics((p, s) => { }, null);
            KeepAliveResponseCustomDataBuilder customData = o => o;

            var action = new ConnectionVerificationProcessAction(endpoint, sendAction, systemDiagnostics, customData);

            Assert.AreEqual(typeof(ConnectionVerificationMessage), action.MessageTypeToProcess);
        }