public void Store()
        {
            using (var client = Context.CreateSaslClient()) {
                var host = Context.GetHost();
                var port = ImapPorts.Ssl;

                client.Connect(host, port);
                var credentials = Context.GetCredentials();
                client.Authenticate(credentials, SaslMechanics.Login);

                client.Select("INBOX");

                var set = SequenceSet.CreateSet(1, 1);
                client.Store(set, MessageFlags.Seen | MessageFlags.Flagged, StoreProcedures.Add);
            }
        }
        public void Expunge()
        {
            using (var client = Context.CreateSaslClient()) {
                client.Security = SecurityPolicies.Explicit;
                var host = Context.GetHost();
                var port = ImapPorts.Ssl;

                client.Connect(host, port);
                var credentials = Context.GetCredentials();
                client.Authenticate(credentials, SaslMechanics.Login);
                client.Select("INBOX");
                client.Store(SequenceSet.CreateSet(1), MessageFlags.Deleted, StoreProcedures.Add);
                client.StatusUpdateReceived += (sender, e) => Debug.WriteLine("Status update received.");
                var response = client.Expunge();
                Assert.IsTrue(response.IsOk);
            }
        }
        public void Fetch()
        {
            using (var client = Context.CreateSaslClient()) {
                var host = Context.GetHost();
                var port = ImapPorts.Ssl;

                client.Connect(host, port);
                var credentials = Context.GetCredentials();
                client.Authenticate(credentials, SaslMechanics.Login);

                client.Select("INBOX");

                var set      = SequenceSet.CreateSet(1);
                var response = client.Fetch(set, "FLAGS");
                Assert.IsTrue(response.IsOk);
                Assert.IsTrue(response.Text.Contains("FLAGS"));
            }
        }
        public void ExecuteQueryFlagsUsingMemberInitTest()
        {
            using (var client = Context.CreateSaslClient()) {
                var host       = Context.GetHost();
                var port       = ImapPorts.Ssl;
                var credential = Context.GetCredentials();

                client.Connect(host, port);
                client.Authenticate(credential, SaslMechanics.Login);
                client.Select("INBOX");

                client.Store(SequenceSet.CreateSet(1), MessageFlags.Seen, StoreProcedures.Add);
                client.Store(SequenceSet.CreateSet(2), MessageFlags.Seen, StoreProcedures.Add);

                var query = from i in client.Messages where i.SequenceNumber >= 1 && i.SequenceNumber <= 2 select new SampleContainer {
                    MyFlags = i.Flags
                };

                var result = query.ToList();
                Assert.IsTrue(result.Count == 2);
                Assert.IsTrue(result[0].MyFlags.HasFlag(MessageFlags.Seen));
                Assert.IsTrue(result[1].MyFlags.HasFlag(MessageFlags.Seen));
            }
        }