Unit Testing in C# -
junior web developer , have been tasked creating unit test project.
[testmethod] public void testgetuser()//shell complete, test code needs review { try { //set test user asamembershipprovider prov = this.getmembershipprovider(); //call user membershipuser user = prov.getuser("test.user", false); //ask username deliberate case differences membershipuser user2 = prov.getuser("test.user", false); //prove still user, assert.arenotequal(null, user); assert.arenotequal(null, user2); //test using “.tolower()” function on resulting string. //verify case doesn’t matter on username. assert.areequal(user.username.tolower(), user2.username.tolower()); assert.areequal(user.username.tolower(), "test.user"); } catch (exception ex) { logmessage(ex); assert.fail(ex.message); } }
Comments
Post a Comment