我对此很陌生,我正在尝试进行测试,我可以在模拟数据库中创建和删除对象,但我不知道现在从哪里开始或如何创建该模拟数据库并读取/写入它。 [Fact] public void CreateCommentaar() { //arrange Commentaar commentaar = new Commentaar { CommentaarId = 0, StadId = 0, UserId = "testId", CommentaarText = "text", Tijdstip = DateTime.Now }; string queryString = "INSERT INTO Commentaar(UserId, StadId, CommentaarText, Tijdstip) VALUES(" + commentaar.CommentaarId + " ," + commentaar.UserId + " ," + commentaar.StadId + " ," + commentaar.CommentaarText + " ," + commentaar.Tijdstip + " ,"; //act //Run Mock sql query //assert //1 commentaar object should exist in mock DB now } [Fact] public void DeleteCommentaar() { //arrange Commentaar commentaar = new Commentaar { CommentaarId = 0, StadId = 0, UserId = "testId", CommentaarText = "text", Tijdstip = DateTime.Now }; string queryString = "INSERT INTO Commentaar(UserId, StadId, CommentaarText, Tijdstip) VALUES(" + commentaar.CommentaarId + " ," + commentaar.UserId + " ," + commentaar.StadId + " ," + commentaar.CommentaarText + " ," + commentaar.Tijdstip + " ,"; //act //Run Mock sql query //assert //1 commentaar object should be deleted }我不太确定如何从这里继续。
- 2 回答
- 0 关注
- 174 浏览
添加回答
举报
0/150
提交
取消