Exemplo n.º 1
0
 public void AuthTest(string user,string pass,bool expected)
 {
     //setUp
     var dir = (String)_conf.Get("dir");
     var datUser = (Dat) _conf.Get("user");
     var sut = new MailBox(new Logger(),datUser,dir);
     //var expected = true;
     //exercise
     var actual = sut.Auth(user,pass);
     //verify
     Assert.That(actual, Is.EqualTo(expected));
 }
Exemplo n.º 2
0
 //パスワード変更
 public static bool Change(string user, string pass, MailBox mailBox, Conf conf)
 {
     if (pass == null){
         //無効なパスワードの指定は失敗する
         return false;
     }
     var dat = (Dat) conf.Get("user");
     foreach (var o in dat){
         if (o.StrList[0] == user){
             o.StrList[1] = Crypt.Encrypt(pass);
             conf.Set("user", dat); //データ変更
             if (mailBox.SetPass(user, pass)){
                 if (mailBox.Auth(user, pass)){
                     return true;
                 }
             }
             return false;
         }
     }
     return false;
 }