public void TestLogDAO_DeleteOneLog() { //添加测试Log,目的通过这个log的插入和删除测试删除操作 LogModel testlog = new LogModel() { Site_id = 666, Status_code = "200", TimeCost = 200, Create_Time = DateTime.Now, Is_error = false, Log_Record = "" }; logDAO.InsertOneLog(testlog); Assert.AreEqual(1, logDAO.DeleteOneLog(testlog.Id)); Assert.AreEqual(0, logDAO.GetLogById(testlog.Id).Site_id);//取一下testlog,看是否取到空log }
public void TestLogDAO_InsertOneLog() { Assert.AreEqual(1, logDAO.InsertOneLog(log)); //插入log Assert.AreEqual(log.Id, logDAO.GetLogById(log.Id).Id); //log插入后获得id,然后看取到值的id,是否和log的id相等 logDAO.DeleteOneLog(log.Id); //清除插入数据 }