public void TestResponseCodeCreation() { foreach (ImapResponseCodeType type in Enum.GetValues(typeof(ImapResponseCodeType))) { Assert.DoesNotThrow(() => ImapResponseCode.Create(type)); } }
internal ImapResponseText(ImapResponseCode code, ImapData[] arguments, string text) { if (code == null) throw new ArgumentNullException("code"); if (arguments == null) throw new ArgumentNullException("arguments"); if (text == null) throw new ArgumentNullException("text"); this.Code = code; this.Arguments = arguments; this.Text = text; }
private static void RejectMalformed(ImapResponseText respText, ImapResponseCode expectedCode, int expectedLength) { if (respText.Code != expectedCode) throw new ImapMalformedDataException(string.Format("expected response code is {0}, but was {1}", expectedCode, respText.Code)); if (respText.Arguments.Length < expectedLength) throw new ImapMalformedDataException(string.Format("too few argument counts; expected is {0} but was {1}", expectedLength, respText.Arguments.Length)); }
public ImapStatusResponse GetResponseCode(ImapResponseCode code) { foreach (var resp in receivedResponses) { var status = resp as ImapStatusResponse; if (status != null && status.ResponseText.Code == code) return status; } return null; }