예제 #1
0
 public Diary(string Id, string pass, string note, DateTime last, PUBLICITY pub, EXCHA excha, WRITA writa, DateTime retTime, string exid)
 {
     this.Id      = Id;
     this.pass    = pass;
     this.note    = note;
     this.last    = last;
     this.pub     = pub;
     this.excha   = excha;
     this.writa   = writa;
     this.retTime = retTime;
     this.exid    = exid;
 }
예제 #2
0
        public async void Createテスト1(string Id, string pass, string note, DateTime last, PUBLICITY pub, EXCHA excha, WRITA writa, DateTime retTime, string exid)
        {
            //POSTデータのバインド
            model.Diary = new Diary(Id, pass, note, last, pub, excha, writa, retTime, exid);

            //POST時の処理
            await model.OnPostAsync();

            //DBからデータの取り出し
            var d = await context.diaries.FindAsync(Id);

            //入力とDBの値が一致するか
            Assert.Equal(Id, d.Id);                    //(expected, actual)
            Assert.Equal(note, d.note);
            Assert.Equal(DateTime.Today, d.last.Date); //日付だけ確認
            Assert.Equal(pub, d.pub);

            //パスワードはハッシュ化されているか
            Assert.True(PBKDF2.Verify(pass, d.pass));

            //入力に関わらず、初期値が入っているか
            Assert.Equal(EXCHA.disable, d.excha);
            Assert.Equal(WRITA.able, d.writa);
            Assert.Equal(DateTime.Today, d.retTime.Date);
            Assert.Null(d.exid);
        }