public void SetUp() { const string mlName = "1ban"; var domainList = new List<string>{ "example.com" }; //var tsDir = new TsDir(); var kernel = new Kernel(); var logger = new Logger(); var manageDir = TestUtil.GetTmpDir("TestDir"); _tsMailSave = new TsMailSave();//MailSaveのモックオブジェクト var memberList = new Dat(new[] { CtrlType.TextBox, CtrlType.TextBox, CtrlType.CheckBox, CtrlType.CheckBox, CtrlType.CheckBox, CtrlType.TextBox }); memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER1", "*****@*****.**", false, true, true, "")); //一般・読者・投稿 memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER2", "*****@*****.**", false, true, false, ""));//一般・読者・× memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER3", "*****@*****.**", false, false, true, ""));//一般・×・投稿 memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN", "*****@*****.**", true, false, true, "123"));//管理者・×・投稿 memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN2", "*****@*****.**", true, true, true, "456"));//管理者・読者・投稿 var docs = (from object o in Enum.GetValues(typeof(MlDocKind)) select "").ToList(); const int maxSummary = 10; const int getMax = 10; const bool autoRegistration = true; const int titleKind = 5; var mlOption = new MlOption(maxSummary, getMax, autoRegistration, titleKind, docs, manageDir, memberList); _ml = new Ml(kernel, logger, _tsMailSave, mlOption, mlName, domainList); }
public void 指定した文字列が表示対象か否かの判断() { var dat = new Dat(new[] { CtrlType.TextBox }); dat.Add(true, "AAA"); dat.Add(true, "表示"); dat.Add(true, "123"); dat.Add(true, "アイウ"); const bool isDisplay = true; var logLimit = new LogLimit(dat, isDisplay); //表示する var expected = true; Check(logLimit, "AAA", expected); Check(logLimit, "表示A", expected); Check(logLimit, "表A123", expected); Check(logLimit, "123", expected); Check(logLimit, "12アイウ", expected); //表示しない expected = false; Check(logLimit, "AA", expected); Check(logLimit, "表a示A", expected); Check(logLimit, "表A23", expected); Check(logLimit, "", expected); Check(logLimit, "12アイ", expected); Check(logLimit, null, expected); }
public void 指定した文字列が表示対象か否かの判断() { var dat = new Dat(new[]{CtrlType.TextBox}); dat.Add(true, "AAA"); dat.Add(true, "表示"); dat.Add(true, "123"); dat.Add(true, "アイウ"); const bool isDisplay = true; var logLimit = new LogLimit(dat, isDisplay); //表示する var expected = true; Check(logLimit, "AAA", expected); Check(logLimit, "表示A", expected); Check(logLimit, "表A123", expected); Check(logLimit, "123", expected); Check(logLimit, "12アイウ", expected); //表示しない expected = false; Check(logLimit, "AA", expected); Check(logLimit, "表a示A", expected); Check(logLimit, "表A23", expected); Check(logLimit, "", expected); Check(logLimit, "12アイ", expected); Check(logLimit, null, expected); }
public void SetUp() { const string mlName = "1ban"; var domainList = new List <string> { "example.com" }; //var tsDir = new TsDir(); var kernel = new Kernel(); var logger = new Logger(); var manageDir = TestUtil.GetTmpDir("TestDir"); _tsMailSave = new TsMailSave();//MailSaveのモックオブジェクト var memberList = new Dat(new[] { CtrlType.TextBox, CtrlType.TextBox, CtrlType.CheckBox, CtrlType.CheckBox, CtrlType.CheckBox, CtrlType.TextBox }); memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER1", "*****@*****.**", false, true, true, "")); //一般・読者・投稿 memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER2", "*****@*****.**", false, true, false, "")); //一般・読者・× memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER3", "*****@*****.**", false, false, true, "")); //一般・×・投稿 memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN", "*****@*****.**", true, false, true, "123")); //管理者・×・投稿 memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN2", "*****@*****.**", true, true, true, "456")); //管理者・読者・投稿 var docs = (from object o in Enum.GetValues(typeof(MlDocKind)) select "").ToList(); const int maxSummary = 10; const int getMax = 10; const bool autoRegistration = true; const int titleKind = 5; var mlOption = new MlOption(maxSummary, getMax, autoRegistration, titleKind, docs, manageDir, memberList); _ml = new Ml(kernel, logger, _tsMailSave, mlOption, mlName, domainList); }
public void Given_an_empty_dat_When_files_are_added_Then_count_returns_correct_value() { Dat df = new Dat(); df.Add("pal8out.bmp", Utils.ReadFile("pal8out.bmp"), true); df.Add("pal4out.bmp", Utils.ReadFile("pal4out.bmp"), false); Assert.AreEqual(2, df.Count, "Incorrect count was returned"); }
//初期化 private LogLimit create(bool isDisplay) { var dat = new Dat(new[] { CtrlType.TextBox }); dat.Add(true, "AAA"); dat.Add(true, "表示"); dat.Add(true, "123"); dat.Add(true, "アイウ"); return(new LogLimit(dat, isDisplay)); }
public void Given_an_empty_dat_When_compressed_files_are_added_Then_returned_buffer_is_correct() { Dat df = new Dat(); df.Add("pal8out.bmp", Utils.ReadFile("pal8out.bmp"), true); df.Add("pal4out.bmp", Utils.ReadFile("pal4out.bmp"), true); byte[] actual = df.Buffer; byte[] expected = Utils.ReadFile("basic.dat"); Assert.IsTrue(actual.SequenceEqual(expected), "Buffer differs"); }
public void SetUp() { var datUser = new Dat(new CtrlType[2] { CtrlType.TextBox, CtrlType.TextBox }); datUser.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA=="); datUser.Add(true, "user2\tNKfF4/Tw/WMhHZvTilAuJQ=="); datUser.Add(true, "user3\tXXX"); _conf = new Conf(); _conf.Add("user", datUser); _mailBox = new MailBox(new Logger(), datUser, "c:\\tmp2\\bjd5\\Pop3Server\\mailbox"); }
public void enableEsmtpによる適用有無の確認_IpV4及びV6を設定(int enableEsmtp, String ipStr, bool expected) { //setUp var range = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox }); range.Add(true, "name\t192.168.0.0/24"); range.Add(true, "name\t8012::1/64"); var sut = new SmtpAuthRange(range, enableEsmtp, null); //exercise var actual = sut.IsHit(new Ip(ipStr)); //verify Assert.That(actual, Is.EqualTo(expected)); }
public void SetUp() { _domainList = new List <string>(); _domainList.Add("example.com"); var datUser = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox }); datUser.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA=="); datUser.Add(true, "user2\tNKfF4/Tw/WMhHZvTilAuJQ=="); datUser.Add(true, "user3\tjNBu6GHNV633O4jMz1GJiQ=="); _mailBox = new MailBox(new Logger(), datUser, "c:\\tmp2\\bjd5\\SmtpServerTest\\mailbox"); }
public void SetUp() { const string dir = "c:\\tmp2\\bjd5\\BJDTest\\mailbox"; _datUser = new Dat(new CtrlType[2] { CtrlType.TextBox, CtrlType.TextBox }); _datUser.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA=="); _datUser.Add(true, "user2\tNKfF4/Tw/WMhHZvTilAuJQ=="); _datUser.Add(true, "user3\tXXX"); sut = new MailBox(new Logger(), _datUser, dir); }
public void SetUp() { var esmtpUserList = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox }); esmtpUserList.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA=="); _smtpAuthUserList = new SmtpAuthUserList(false, null, esmtpUserList); }
public void Multi() { Dit.Add(dit); Dit.Add(dut); Dit.Add(dit); Dat.Add(dut); Dat.Add(dit); Dat.Add(dat); Assert.IsTrue(Dit.UnsequencedEquals(Dat)); Assert.IsFalse(Dit.UnsequencedEquals(Dut)); }
void client1_GetStateCompleted(object sender, ServiceReference1.GetStateCompletedEventArgs e) { try { // lst2.Items.Clear(); Dices.Clear(); Dat.Clear(); foreach (var item in e.Result.lastDieRoll) { Dat.Add(new Dicies() { Dieces = item }); } Dices.Add(new Dice() { TileName = e.Result.ActiveTileName }); } catch (Exception ex) { // MessageBox.Show(ex.ToString()); } }
public void SetUp() { //var kernel = new Kernel(null,null,null,null); //var logger = new Logger(kernel,"",false,null); //参加者 var dat = new Dat(new[] { CtrlType.TextBox, CtrlType.TextBox, CtrlType.CheckBox, CtrlType.CheckBox, CtrlType.CheckBox, CtrlType.TextBox }); bool manager = false; dat.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER1", "*****@*****.**", manager, true, true, "")); //読者・投稿 dat.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER2", "*****@*****.**", manager, true, false, ""));//読者 × dat.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER3", "*****@*****.**", manager, false, true, ""));//× 投稿 manager = true;//管理者 dat.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN", "*****@*****.**", manager, false, true, "123"));//× 投稿 _mlUserList = new MlUserList(dat); }
public void 許可リスト有り_のみ許可する_Allow() { //setUp const int port = 9987; const int enableAcl = 0; //指定したアドレスからのアクセスのみを許可する var acl = new Dat(new[] { CtrlType.TextBox, CtrlType.TextBox }); //許可リストあり acl.Add(true, "NAME\t127.0.0.1"); var sut = StartServer(port, enableAcl, acl); var cl = StartClient(port); var expected = 1; // Allow //exercise var actual = sut.Count(); //verify Assert.That(actual, Is.EqualTo(expected)); //tearDown cl.Close(); sut.Stop(); sut.Dispose(); }
public void SetUp() { var datUser = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox }); datUser.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA=="); _mailBox = new MailBox(new Logger(), datUser, "c:\\tmp2\\bjd5\\SmtpServerTest\\mailbox"); }
public void SetUp() { //var kernel = new Kernel(null,null,null,null); //var logger = new Logger(kernel,"",false,null); //参加者 var dat = new Dat(new[] { CtrlType.TextBox, CtrlType.TextBox, CtrlType.CheckBox, CtrlType.CheckBox, CtrlType.CheckBox, CtrlType.TextBox }); bool manager = false; dat.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER1", "*****@*****.**", manager, true, true, "")); //読者・投稿 dat.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER2", "*****@*****.**", manager, true, false, "")); //読者 × dat.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER3", "*****@*****.**", manager, false, true, "")); //× 投稿 manager = true; //管理者 dat.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN", "*****@*****.**", manager, false, true, "123")); //× 投稿 _mlUserList = new MlUserList(dat); }
public void 重複する2つのリソースの追加() { //setUp var dat = new Dat(new CtrlType[5]); dat.Add(true, "0\twww\talias\t192.168.0.1\t10"); dat.Add(true, "0\twww\talias\t192.168.0.1\t10"); var sut = new RrDb(null, null, dat, "example.com", true); //(1)a www.example.com. 192.168.0.1 //(2)ptr 1.0.168.192.in.addr.ptr www.example.com. var expected = 2; //exercise var actual = RrDbTest.Size(sut); //verify Assert.That(actual, Is.EqualTo(expected)); }
public void Given_an_empty_dat_When_uncompressed_files_are_added_Then_buffer_size_is_correct() { Dat df = new Dat(); byte[] pal8 = Utils.ReadFile("pal8out.bmp"); df.Add("pal8out.bmp", pal8, false); byte[] actual = df.Buffer; Assert.AreEqual(pal8.Length + 24, actual.Length, "Buffer length is incorrect"); }
public Dat Export() { var dat = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox, CtrlType.TextBox, CtrlType.TextBox, CtrlType.TextBox, CtrlType.TextBox }); foreach (var o in _ar){ var str = string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", o.Name, o.MailAddress, o.IsManager, o.IsReader, o.IsContributor, Crypt.Encrypt(o.Psssword)); dat.Add(o.Enable, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", o.Name, o.MailAddress, o.IsManager, o.IsReader, o.IsContributor, Crypt.Encrypt(o.Psssword))); } return dat; }
public void 一部が重複する2つのリソースの追加() { //setUp var dat = new Dat(new CtrlType[5]); dat.Add(true, "0\tns\talias\t192.168.0.1\t10"); dat.Add(true, "1\tns\talias\t192.168.0.1\t10"); var sut = new RrDb(null, null, dat, "example.com", true); //(1)a ns.example.com. 192.168.0.1 //(2)ptr 1.0.168.192.in.addr.ptr ns.example.com. //(3)ns example.com. ns.example.com. var expected = 3; //exercise int actual = Size(sut); //verify Assert.That(actual, Is.EqualTo(expected)); }
public void SetUp() { //mailBoxに"user1"を登録 var datUser = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox }); datUser.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA=="); _mailBox = new MailBox(new Logger(), datUser, "c:\\tmp2\\bjd5\\SmtpServerTest\\mailbox"); //esmtpUserListに"user2"を登録 _esmtpUserList = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox }); _esmtpUserList.Add(true, "user2\tNKfF4/Tw/WMhHZvTilAuJQ=="); }
public Dat Export() { var dat = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox, CtrlType.TextBox, CtrlType.TextBox, CtrlType.TextBox, CtrlType.TextBox }); foreach (var o in _ar) { var str = string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", o.Name, o.MailAddress, o.IsManager, o.IsReader, o.IsContributor, Crypt.Encrypt(o.Psssword)); dat.Add(o.Enable, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", o.Name, o.MailAddress, o.IsManager, o.IsReader, o.IsContributor, Crypt.Encrypt(o.Psssword))); } return(dat); }
//更新 void Update() { if (kernel != null) { Dat dat = new Dat(); foreach (var o in ar) { dat.Add(o.Enable, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", o.Name, o.MailAddress.ToString(), o.IsManager, o.IsReader, o.IsContributor, Crypt.Encrypt(o.Psssword))); } op.SetVal("memberList", dat); kernel.OptionRead2(op.NameTag);//オプションの再読み込み } }
public void 許可リストだけの場合(int order, bool isAllow) { //setUp var allowList = new Dat(new CtrlType[] { CtrlType.TextBox }); allowList.Add(true, "192.168.0.0/24"); var sut = new Relay(allowList, null, order, null); var expected = isAllow; //exercise var actual = sut.IsAllow(new Ip("192.168.0.1")); //verify Assert.That(actual, Is.EqualTo(expected)); }
public void SetUp() { var tsDir = new TsDir(); _tsOption = new TsOption(tsDir); _tsOption.Set("FOLDER", "MailBox", "dir", string.Format("{0}\\MailBox", tsDir.Src)); //user1,user2,user3 _tsOption.Set("DAT", "MailBox", "user", "user1\tpass\buser2\tpass\buser3\tpass"); var kernel = new Kernel(null, null, null, null); var logger = new Logger(kernel, "LOG", false, null); var manageDir = tsDir.Src + "\\TestDir"; //MailQueue _mailQueue = new MailQueue(tsDir.Src + "\\MailQueue"); var oneOption = kernel.ListOption.Get("MailBox"); _mailBox = new MailBox(kernel, oneOption); var mailSave = new MailSave(kernel, _mailBox, logger, _mailQueue, "", _domainList);//モック var memberList = new Dat(); memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER1", "*****@*****.**", false, true, true, "")); //一般・読者・投稿 memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER2", "*****@*****.**", false, true, false, "")); //一般・読者・× memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER3", "*****@*****.**", false, false, true, "")); //一般・×・投稿 //memberList.Add(false, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER6" , "*****@*****.**" , false, false, true, ""));//一般・×・投稿 (Disable) //memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN" , "*****@*****.**" , true, false, true, "123"));//管理者・×・投稿 //memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN2", "*****@*****.**", true, true, true, "456"));//管理者・読者・投稿 //memberList.Add(false, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN3", "*****@*****.**", true, true, true, "789"));//管理者・読者・投稿 (Disable) var docs = (from object o in Enum.GetValues(typeof(MLDocKind)) select "").ToList(); const int maxSummary = 10; const int getMax = 10; const bool autoRegistration = true; const int titleKind = 1; var mlOption = new MlOption(maxSummary, getMax, autoRegistration, titleKind, docs, manageDir, memberList); _ml = new Ml(kernel, logger, mailSave, mlOption, _mlName, _domainList); }
public void Given_an_empty_dat_When_files_are_added_Then_they_can_be_correctly_retrieved() { byte[] pal8 = Utils.ReadFile("pal8out.bmp"); byte[] pal4 = Utils.ReadFile("pal4out.bmp"); Dat df = new Dat(); df.Add("pal8out.bmp", pal8, true); df.Add("pal4out.bmp", pal4, false); uint count = 0; foreach (Dat.DatItem item in df) { Assert.AreEqual(count, item.Index, "Index is not correct"); switch (count) { case 0: Assert.IsTrue(item.IsCompressed, "Compression flag is not correct"); Assert.AreEqual(4767u, item.CompressedSize, "Compressed size is not correct"); Assert.AreEqual(9270u, item.UncompressedSize, "Uncompressed size is not correct"); Assert.AreEqual("pal8out.bmp", item.FileName, "Filename is not correct"); Assert.IsTrue(item.Buffer.SequenceEqual(pal8), "Buffer is not correct"); break; case 1: Assert.IsFalse(item.IsCompressed, "Compression flag is not correct"); Assert.AreEqual(4214u, item.CompressedSize, "Compressed size is not correct"); Assert.AreEqual(4214u, item.UncompressedSize, "Uncompressed size is not correct"); Assert.AreEqual("pal4out.bmp", item.FileName, "Filename is not correct"); Assert.IsTrue(item.Buffer.SequenceEqual(pal4), "Buffer is not correct"); break; default: Assert.Fail("Too many iterations"); break; } count++; } }
[TestCase(1, true)] //禁止リスト優先 public void 許可リストだけの場合(int order, bool isAllow) { //setUp var allowList = new Dat(new CtrlType[] { CtrlType.TextBox }); allowList.Add(true, "192.168.0.0/24"); var sut = new Relay(allowList, null, order, null); var expected = isAllow; //exercise var actual = sut.IsAllow(new Ip("192.168.0.1")); //verify Assert.That(actual, Is.EqualTo(expected)); }
public void SetUp() { var tsDir = new TsDir(); _tsOption = new TsOption(tsDir); _tsOption.Set("FOLDER", "MailBox", "dir", string.Format("{0}\\MailBox", tsDir.Src)); //user1,user2,user3 _tsOption.Set("DAT", "MailBox", "user", "user1\tpass\buser2\tpass\buser3\tpass"); var kernel = new Kernel(null, null, null, null); var logger = new Logger(kernel, "LOG", false, null); var manageDir = tsDir.Src + "\\TestDir"; //MailQueue _mailQueue = new MailQueue(tsDir.Src + "\\MailQueue"); var oneOption = kernel.ListOption.Get("MailBox"); _mailBox = new MailBox(kernel, oneOption); var mailSave = new MailSave(kernel, _mailBox, logger, _mailQueue, "", _domainList);//モック var memberList = new Dat(); memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER1", "*****@*****.**", false, true, true, "")); //一般・読者・投稿 memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER2", "*****@*****.**", false, true, false, ""));//一般・読者・× memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER3", "*****@*****.**", false, false, true, ""));//一般・×・投稿 //memberList.Add(false, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER6" , "*****@*****.**" , false, false, true, ""));//一般・×・投稿 (Disable) //memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN" , "*****@*****.**" , true, false, true, "123"));//管理者・×・投稿 //memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN2", "*****@*****.**", true, true, true, "456"));//管理者・読者・投稿 //memberList.Add(false, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN3", "*****@*****.**", true, true, true, "789"));//管理者・読者・投稿 (Disable) var docs = (from object o in Enum.GetValues(typeof(MLDocKind)) select "").ToList(); const int maxSummary = 10; const int getMax = 10; const bool autoRegistration = true; const int titleKind = 1; var mlOption = new MlOption(maxSummary, getMax, autoRegistration, titleKind, docs, manageDir, memberList); _ml = new Ml(kernel, logger, mailSave, mlOption, _mlName, _domainList); }
public void enableNum_0で_のみを許可する_を検証する(string aclStr, string ipStr, AclKind expected) { //setUp int enableNum = 0; //enableNum=0 のみを許可する Dat dat = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.AddressV4 }); if (!dat.Add(true, string.Format("NAME\t{0}", aclStr))) { Assert.Fail("このエラーが発生したら、テストの実装に問題がある"); } var ip = TestUtil.CreateIp(ipStr); AclList sut = new AclList(dat, enableNum, new Logger()); //exercise AclKind actual = sut.Check(ip); //verify Assert.That(actual, Is.EqualTo(expected)); }
//*********************************************************************** // コントロールの値の読み書き //*********************************************************************** protected override object AbstractRead() { var dat = new Dat(CtrlTypeList); //チェックリストボックスの内容からDatオブジェクトを生成する for (int i = 0; i < _listView.Items.Count; i++) { //bool enable = _checkedListBox.GetItemChecked(i); bool enable = _listView.Items[i].Checked; //if (!dat.Add(enable, _checkedListBox.Items[i].ToString())) { if (!dat.Add(enable, ListViewItemToString(i))) { Util.RuntimeException("CtrlDat abstractRead() 外部入力からの初期化ではないので、このエラーは発生しないはず"); } } return(dat); }
public void Appendによるヘッダの追加() { //setUp var appned = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox }); appned.Add(true, "tag2\tzzz"); var sut = new ChangeHeader(null, appned); var mail = new Mail(); var expected = "zzz"; //exercise sut.Exec(mail, new Logger()); var actual = mail.GetHeader("tag2"); //varify Assert.That(actual, Is.EqualTo(expected)); }
public void Relpaceによるヘッダの置き換え4() { //setUp var replace = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox }); replace.Add(true, "User-Agent:.*\tUser-Agent:Henteko Mailer 09.87.12"); var sut = new ChangeHeader(replace, null); var mail = new Mail(); mail.AddHeader("User-Agent", "Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130801 Thunderbird/17.0.8"); var expected = "Henteko Mailer 09.87.12"; //exercise sut.Exec(mail, new Logger()); var actual = mail.GetHeader("User-Agent"); //varify Assert.That(actual, Is.EqualTo(expected)); }
public void Relpaceによるヘッダの置き換え() { //setUp var replace = new Dat(new CtrlType[]{CtrlType.TextBox, CtrlType.TextBox}); replace.Add(true, "ABC\tXYZ"); var sut = new ChangeHeader(replace, null); var mail = new Mail(); mail.AddHeader("tag1", "ABC123"); mail.AddHeader("tag2", "DEF123"); mail.AddHeader("tag3", "GHI123"); var expected = "tag1: XYZ123\r\n"; //exercise sut.Exec(mail, new Logger()); var actual = Encoding.ASCII.GetString(mail.GetBytes()).Substring(0, 14); //varify Assert.That(actual, Is.EqualTo(expected)); }
public void Relpaceによるヘッダの置き換え2() { //setUp var replace = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox }); replace.Add(true, "ABC\tBBB"); var sut = new ChangeHeader(replace, null); var mail = new Mail(); mail.AddHeader("tag1", "ABC123"); mail.AddHeader("tag2", "DEF123"); mail.AddHeader("tag3", "GHI123"); var expected = "BBB123"; //exercise sut.Exec(mail, new Logger()); var actual = mail.GetHeader("tag1"); //varify Assert.That(actual, Is.EqualTo(expected)); }
MlOption CreateMlOption() { const int maxSummary = 20; const int maxGet = 20; const bool autoRegistration = true; //自動登録 var tsDir = new TsDir(); const int titleKind = 1; var memberList = new Dat(); memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER1", "*****@*****.**", false, true, true, "")); //読者・投稿 memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER2", "*****@*****.**", false, true, false, "")); //読者 × memberList.Add(false, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER6", "*****@*****.**", false, false, true, "")); //× 投稿 (Disable) memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER3", "*****@*****.**", false, false, true, "")); //× 投稿 memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN", "*****@*****.**", true, false, true, "123")); //× 投稿 memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN2", "*****@*****.**", true, true, true, "456")); //読者 投稿 memberList.Add(false, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN3", "*****@*****.**", true, true, true, "789")); //読者 投稿 (Disable) return(new MlOption(null, maxSummary, maxGet, autoRegistration, titleKind, Docs, tsDir.Src + "\\TestDir", memberList)); }
public void Relpaceによるヘッダの置き換え3() { //setUp var replace = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox }); replace.Add(true, "EFGH\tWXYZ"); var sut = new ChangeHeader(replace, null); var mail = new Mail(); mail.AddHeader("To", "\"ABCD\" <****@******>"); mail.AddHeader("From", "\"EFGH\" <****@******>"); mail.AddHeader("Subject", "test"); var expected = "\"WXYZ\" <****@******>"; //exercise sut.Exec(mail, new Logger()); var actual = mail.GetHeader("From"); //varify Assert.That(actual, Is.EqualTo(expected)); }
public void 許可リスト有り_のみ許可する_Allow() { //setUp const int port = 9987; const int enableAcl = 0; //指定したアドレスからのアクセスのみを許可する var acl = new Dat(new[]{CtrlType.TextBox, CtrlType.TextBox}); //許可リストあり acl.Add(true, "NAME\t127.0.0.1"); var sut = StartServer(port, enableAcl, acl); var cl = StartClient(port); var expected = 1; // Allow //exercise var actual = sut.Count(); //verify Assert.That(actual, Is.EqualTo(expected)); //tearDown cl.Close(); sut.Stop(); sut.Dispose(); }
public void SetUp() { _domainList = new List<string>(); _domainList.Add("example.com"); var datUser = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox }); datUser.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA=="); datUser.Add(true, "user2\tNKfF4/Tw/WMhHZvTilAuJQ=="); datUser.Add(true, "user3\tjNBu6GHNV633O4jMz1GJiQ=="); _mailBox = new MailBox(new Logger(), datUser, "c:\\tmp2\\bjd5\\SmtpServerTest\\mailbox"); }
MlUserList CreateMlUsers2() { var kernel = new Kernel(null, null, null, null); var logger = new Logger(kernel, "", false, null); //参加者 MemberList = new Dat(); bool manager = false; MemberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER1", "*****@*****.**", manager, true, true, "")); //読者・投稿 MemberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER2", "*****@*****.**", manager, true, false, ""));//読者 × MemberList.Add(false, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER6", "*****@*****.**", manager, false, true, ""));//× 投稿 (Disable) MemberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER3", "*****@*****.**", manager, false, true, ""));//× 投稿 manager = true;//管理者 MemberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN", "*****@*****.**", manager, false, true, "123"));//× 投稿 MemberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN2", "*****@*****.**", manager, true, true, "456"));//読者 投稿 MemberList.Add(false, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN3", "*****@*****.**", manager, true, true, "789"));//読者 投稿 (Disable) var mlUserList = new MlUserList(MemberList); return mlUserList; }
public void SetUp() { //mailBoxに"user1"を登録 var datUser = new Dat(new CtrlType[] { CtrlType.TextBox, CtrlType.TextBox }); datUser.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA=="); _mailBox = new MailBox(new Logger(), datUser, "c:\\tmp2\\bjd5\\SmtpServerTest\\mailbox"); //esmtpUserListに"user2"を登録 _esmtpUserList = new Dat(new CtrlType[]{CtrlType.TextBox, CtrlType.TextBox }); _esmtpUserList.Add(true, "user2\tNKfF4/Tw/WMhHZvTilAuJQ=="); }
public void SetUp() { const string dir = "c:\\tmp2\\bjd5\\BJDTest\\mailbox"; _datUser = new Dat(new CtrlType[2]{CtrlType.TextBox, CtrlType.TextBox}); _datUser.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA=="); _datUser.Add(true, "user2\tNKfF4/Tw/WMhHZvTilAuJQ=="); _datUser.Add(true, "user3\tXXX"); sut = new MailBox(new Logger(),_datUser,dir); }
//*********************************************************************** // コントロールの値の読み書き //*********************************************************************** protected override object AbstractRead() { var dat = new Dat(CtrlTypeList); //チェックリストボックスの内容からDatオブジェクトを生成する for (int i = 0; i < _listView.Items.Count; i++){ //bool enable = _checkedListBox.GetItemChecked(i); bool enable = _listView.Items[i].Checked; //if (!dat.Add(enable, _checkedListBox.Items[i].ToString())) { if (!dat.Add(enable, ListViewItemToString(i))) { Util.RuntimeException("CtrlDat abstractRead() 外部入力からの初期化ではないので、このエラーは発生しないはず"); } } return dat; }
//初期化 private LogLimit create(bool isDisplay) { var dat = new Dat(new[]{CtrlType.TextBox}); dat.Add(true, "AAA"); dat.Add(true, "表示"); dat.Add(true, "123"); dat.Add(true, "アイウ"); return new LogLimit(dat, isDisplay); }
MlOption CreateMlOption() { const int maxSummary = 20; const int maxGet = 20; const bool autoRegistration = true; //自動登録 var tsDir = new TsDir(); const int titleKind = 1; var memberList = new Dat(); memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER1", "*****@*****.**", false, true, true, "")); //読者・投稿 memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER2", "*****@*****.**", false, true, false, ""));//読者 × memberList.Add(false, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER6", "*****@*****.**", false, false, true, ""));//× 投稿 (Disable) memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "USER3", "*****@*****.**", false, false, true, ""));//× 投稿 memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN", "*****@*****.**", true, false, true, "123"));//× 投稿 memberList.Add(true, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN2", "*****@*****.**", true, true, true, "456"));//読者 投稿 memberList.Add(false, string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}", "ADMIN3", "*****@*****.**", true, true, true, "789"));//読者 投稿 (Disable) return new MlOption(null,maxSummary, maxGet, autoRegistration,titleKind,Docs,tsDir.Src + "\\TestDir",memberList); }
public void SetUp() { var datUser = new Dat(new CtrlType[]{CtrlType.TextBox, CtrlType.TextBox}); datUser.Add(true, "user1\t3OuFXZzV8+iY6TC747UpCA=="); _mailBox = new MailBox(new Logger(), datUser, "c:\\tmp2\\bjd5\\SmtpServerTest\\mailbox"); }
Dat AddDat(Dat dat, LimitKind limitKind, string url) { dat.Add(true, string.Format("{0}\t{1}",url,(int)limitKind)); return dat; }