public void TestFindByTag() { var list = new PopCapabilityList(new[] { PopCapability.Uidl, PopCapability.Pipelining, new PopCapability("SASL", "CRAM-MD5"), new PopCapability("SASL", "PLAIN"), }); Assert.AreEqual(PopCapability.Uidl, list.FindByTag(PopCapability.Uidl)); Assert.AreEqual(PopCapability.Uidl, list.FindByTag("UIDL")); Assert.AreEqual(PopCapability.Uidl, list.FindByTag("uidl")); Assert.IsNotNull(list.FindByTag(PopCapability.Sasl)); Assert.IsNull(list.FindByTag(PopCapability.Expire)); }
public void TestIsCapable() { var list = new PopCapabilityList(new[] { PopCapability.Uidl, PopCapability.Pipelining, new PopCapability("SASL", "CRAM-MD5"), new PopCapability("SASL", "PLAIN"), }); Assert.IsTrue(list.IsCapable(PopCapability.Uidl)); Assert.IsTrue(list.IsCapable(PopCapability.Sasl)); Assert.IsTrue(list.IsCapable(new PopCapability("uidl"))); Assert.IsTrue(list.IsCapable(new PopCapability("sasl"))); Assert.IsFalse(list.IsCapable(new PopCapability("SASL", "DIGEST-MD5"))); Assert.IsFalse(list.IsCapable(PopCapability.Expire)); }
/* * methods for internal state management */ internal void SetServerCapabilities(PopCapabilityList newCapabilities) { serverCapabilities = new PopCapabilityList(true, newCapabilities); }
/// <summary>sends CAPA command</summary> /// <remarks>valid in any state</remarks> public PopCommandResult Capa(out PopCapabilityList capabilities) { RejectNonConnectedState(); capabilities = null; using (var t = new CapaTransaction(connection)) { if (ProcessTransaction(t).Succeeded) { SetServerCapabilities(t.Result.Value); capabilities = t.Result.Value; } return t.Result; } }
internal void SetSessionInfo(PopSession session) { ServerCapabilities = new PopCapabilityList(true, session.ServerCapabilities); }
/* * draft */ /* * extended capabilities */ static PopCapability() { var capabilities = new List<PopCapability>(GetDefinedConstants<PopCapability>()); foreach (var saslMechansim in SaslMechanisms.AllMechanisms) { capabilities.Add(new PopCapability("SASL", saslMechansim)); } AllCapabilities = new PopCapabilityList(true, capabilities); }