public void SubjectIndexRepository_Insert_ShouldSuccess()
        {
            SubjectIndexRepository repository = new SubjectIndexRepository();
            DateTime        now         = DateTime.Now;
            Yw_SubjectIndex addedEntity = repository.Insert(new Yw_SubjectIndex()
            {
                Ysi_Id         = 0,
                Ysi_CreateTime = now,
                Ysi_Creator    = 10000,
                Ysi_Difficulty = (int)DifficultyEnum.一般,
                Ysi_Keyword    = "key-zhcy",
                Ysi_SubjectId  = 10005
            });

            Assert.IsNotNull(addedEntity);
            Assert.IsTrue(addedEntity.Ysi_Id > 0);
            Assert.AreEqual(10005, addedEntity.Ysi_SubjectId);
        }
Esempio n. 2
0
        public void SubjectIndexRepository_Delete_ShouldSuccess()
        {
            SubjectIndexRepository repository = new SubjectIndexRepository();
            var added = repository.Insert(new Domain.Entity.Yw_SubjectIndex
            {
                Ysi_Keyword    = "key",
                Ysi_Difficulty = 2,
                Ysi_SubjectId  = 10000,
                Ysi_CreateTime = DateTime.Now,
                Ysi_Creator    = 10000
            });
            //var dbEntity = repository.GetEntity(added.Ysi_Id);
            //Assert.IsNotNull(dbEntity);
            //Assert.IsTrue(dbEntity.Ysi_Keyword == "key");
            //repository.Delete(
            //    new List<int> { added.Ysi_Id });

            //dbEntity = repository.GetEntity(added.Ysi_Id);
            //Assert.IsNull(dbEntity);
        }