public void Equals_is_false_Additional_different_in_other_response() { var response1 = new SmtpResponse(250, "", new[] { "line" }); var response2 = new SmtpResponse(250, "", new[] { "different line" }); Assert.False(response1.Equals(response2)); Assert.False(response1.Equals((object)response2)); }
public void Equals_is_false_ResponseCode_doesnt_match() { var response1 = new SmtpResponse(250, ""); var response2 = new SmtpResponse(251, ""); Assert.False(response1.Equals(response2)); Assert.False(response1.Equals((object)response2)); Assert.NotEqual(response1.GetHashCode(), response2.GetHashCode()); }
public void Equals_is_false_ResponseText_doesnt_match() { var response1 = new SmtpResponse(250, "text"); var response2 = new SmtpResponse(250, "different text"); Assert.False(response1.Equals(response2)); Assert.False(response1.Equals((object)response2)); Assert.NotEqual(response1.GetHashCode(), response2.GetHashCode()); }
public void Equals_is_true_when_everything_matches() { var response1 = new SmtpResponse(250, "same", new[] { "line" }); var response2 = new SmtpResponse(250, "same", new[] { "line" }); Assert.True(response1.Equals(response2)); Assert.True(response1.Equals((object)response2)); Assert.Equal(response1.GetHashCode(), response2.GetHashCode()); }
private static SmtpResponse GetResponseForRecipient(MailRecipient recipient, bool retryOnDuplicateDelivery) { SmtpResponse result = recipient.SmtpResponse; if (result.Equals(SmtpResponse.Empty)) { result = SmtpResponse.NoopOk; } if (retryOnDuplicateDelivery) { result = AckReason.DeliverAgentTransientFailure; if (recipient.ExtendedProperties.Contains("ExceptionAgentName")) { result.StatusText[0] = string.Format("{0}[Agent: {1}]", AckReason.DeliverAgentTransientFailure.StatusText[0], recipient.ExtendedProperties.GetValue <string>("ExceptionAgentName", string.Empty)); } } return(result); }
public void Equals_is_false_Additional_missing_in_other_response() { var response1 = new SmtpResponse(250, "", new[] { "line" }); var response2 = new SmtpResponse(250, ""); Assert.False(response1.Equals(response2)); Assert.False(response1.Equals((object)response2)); }