示例#1
0
        public void SetUp()
        {
            var mlAddr = new MlAddr("1ban", new List <string> {
                "example.com"
            });
            var docs = new List <string>();

            foreach (var docKind in Enum.GetValues(typeof(MlDocKind)))
            {
                var buf = docKind.ToString();
                if (buf.Length < 2 || buf[buf.Length - 2] != '\r' || buf[buf.Length - 1] != '\n')
                {
                    buf = buf + "\r\n";
                }
                docs.Add(buf);
            }
            _mlCreator = new MlCreator(mlAddr, docs);
        }
示例#2
0
 public void SetUp()
 {
     _mlAddr = new MlAddr("1ban", new List <string> {
         "example.com"
     });
 }
示例#3
0
        public Initialization2()
        {
            var tsDir = new TsDir();
            //var tsOption = new TsOption(tsDir);
            //var manageDir = tsDir.Src + "\\TestDir";

            //TmpDir2 = string.Format("{0}/../../TestDir", Directory.GetCurrentDirectory());
            var optionDef = tsDir.Src + "\\Option.def";


            //Docs
            Docs = new List <string>();
            var lines = File.ReadAllLines(optionDef, Encoding.GetEncoding(932));

            foreach (MlDocKind docKind in Enum.GetValues(typeof(MlDocKind)))
            {
                var  tag = string.Format("MEMO=Ml\b{0}Document=", docKind.ToString().ToLower());
                bool hit = false;
                foreach (var l in lines)
                {
                    if (l.IndexOf(tag) == 0)
                    {
                        Docs.Add(l.Substring(tag.Length));
                        hit = true;
                        break;
                    }
                }
                if (!hit)
                {
                    Docs.Add("");
                }
            }

            Kernel     = new Kernel(null, null, null, null);
            Logger     = Kernel.CreateLogger("LOG", true, null);
            domainList = new List <string>()
            {
                "example.com"
            };
            MlAddr = new MlAddr(mlName, domainList);
            var mailQueue = new MailQueue(tsDir.Src + "TestDir");
            var oneOption = new Option(Kernel, "", "");
            var mailBox   = new MailBox(Kernel, oneOption);

            MailSave = new MailSave(Kernel, mailBox, Logger, mailQueue, "", domainList);
            MlOption = CreateMlOption();
            //MlUserList = CreateMlUsers();

            Ml = new Ml(Kernel, Logger, MailSave, MlOption, mlName, domainList);
            //30件のメールを保存
            for (int i = 0; i < 30; i++)
            {
                var mail = new Mail(null);
                mail.Init(Encoding.ASCII.GetBytes("\r\n"));  //区切り行(ヘッダ終了)
                mail.AddHeader("subject", string.Format("[{0}:{1:D5}]TITLE", mlName, i + 1));
                mail.Init(Encoding.ASCII.GetBytes("1\r\n")); //本文
                mail.Init(Encoding.ASCII.GetBytes("2\r\n")); //本文
                mail.Init(Encoding.ASCII.GetBytes("3\r\n")); //本文

                Ml.Save(mail);
            }
        }
示例#4
0
 public void SetUp()
 {
     mlAddr = new MlAddr(name, domainList);
 }