View Single Post
  #1 (permalink)  
Old April 6th, 2010, 02:36 PM
dotnet_user dotnet_user is offline
Registered User
 
Join Date: Apr 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Object reference not set to an instance of an object.

When I'm writing a unit test for failed authentication, I'm getting an error like this: Object reference not set to an instance of an object.

Here's my code(pretty simple):

//validate with wrong username
//The validation fails here(as expected) but I get the error: Object reference not set to an instance of an object.

ValidateUserResults validateUserTestFail = serviceClient.ValidateUser("wrongusername", "newPass1-i");
Assert.IsFalse(validateUserTestFail.Success, "Validate result should have been false");

// Authentication failed-wrong password
//The validation fails here too(as expected) but I don't get the error.

ValidateUserResults validateUserTestFail1 = serviceClient.ValidateUser("newuser1", "wrongpassword");
Assert.IsFalse(validateUserTestFail1.Success, "Validate result should have been true");

Can anybody please tell me why this is happening? I tried everything I can, but couldn't find a solution....

Thanks a lot in advance