public void InvokeWithFailingResponse() { var endpoint = new EndpointId("id"); int count = 0; SendMessage sendAction = (e, m, r) => { count++; if (count <= 1) { throw new Exception(); } }; int loggerCount = 0; var systemDiagnostics = new SystemDiagnostics((p, s) => { loggerCount++; }, null); var action = new UnknownMessageTypeProcessAction(endpoint, sendAction, systemDiagnostics); action.Invoke(new SuccessMessage(new EndpointId("otherId"), new MessageId())); Assert.AreEqual(1, count); Assert.AreEqual(1, loggerCount); }
public void MessageTypeToProcess() { var endpoint = new EndpointId("id"); SendMessage sendAction = (e, m, r) => { }; var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null); var action = new UnknownMessageTypeProcessAction(endpoint, sendAction, systemDiagnostics); Assert.AreEqual(typeof(ICommunicationMessage), action.MessageTypeToProcess); }
public void Invoke() { var endpoint = new EndpointId("id"); EndpointId storedEndpoint = null; ICommunicationMessage storedMsg = null; SendMessage sendAction = (e, m, r) => { storedEndpoint = e; storedMsg = m; }; var systemDiagnostics = new SystemDiagnostics((p, s) => { }, null); var action = new UnknownMessageTypeProcessAction(endpoint, sendAction, systemDiagnostics); var otherEndpoint = new EndpointId("otherId"); action.Invoke(new SuccessMessage(otherEndpoint, new MessageId())); Assert.AreSame(otherEndpoint, storedEndpoint); Assert.IsInstanceOf <FailureMessage>(storedMsg); }