我是单元测试的新手,我并不总是“看到”需要测试的内容。目前我正在创建单元测试以验证用户是否已从应用程序中删除。
这是我到目前为止所拥有的。任何人都可以看看这个并为其他要测试的东西提出一些建议,或者我是否已经为删除用户帐户覆盖了大部分内容?
MembershipProvider prov = this.GetMembershipProvider();
MembershipCreateStatus status;
MembershipUser user = prov.CreateUser("UserX", "12345", "test.UserX@abc.com", "", "", true, null, out status);
//call get user
user = prov.GetUser("UserX", false);
//Deletes user and all related information
prov.DeleteUser("UserX", true);
// Try to retrieve user again
user = prov.GetUser("UserX", false);
//test to see if user has been deleted
Assert.AreEqual(null, user);