public ImapMailBox(IClientConfiguration config, IMailBoxLogger mbLogger, IImapWorker imapWorker, IImapIdler imapIdler, IEmailSender emailSender) { _config = config; _mbLogger = mbLogger; _imapWorker = imapWorker; _imapIdler = imapIdler; _emailSender = emailSender; MailBoxName = _config.MailBoxName; MailBoxId = _config.Id; }
public void Dispose() { Trace.WriteLine($"{MailBoxName} Dispose Called"); _imapIdler.MessageArrived -= ImapIdlerOnMessageArrived; _imapIdler.MessageExpunged -= ImapIdlerOnMessageExpunged; _imapIdler.MessageSeen -= ImapIdlerOnMessageSeen; _emailSender.ExceptionHappened -= EmailSenderOnExceptionHappened; _imapIdler.IntegrityCheck -= ImapIdlerOnIntegrityCheck; NewMessageReceived = null; MessageRemoved = null; _imapWorker = null; _imapIdler = null; _emailSender = null; _emailFilterer = null; _mbLogger = null; _config = null; logger = null; }
public void TestInitialize() { _configuration = new Mock<ImapClientConfiguration>(); //mock client client = new Mock<IImapClient>(); //mock inbox folder inbox = new Mock<IMailFolder>(); //client returns mock inbox client.Setup(x => x.Inbox).Returns(inbox.Object); //mock factory factory = new Mock<IImapFactory>(); factory.Setup(x => x.GetClient()).ReturnsAsync(client.Object); //create the idler and start setup _imapWorker = new ImapWorker(factory.Object); }