Here is my code for button login..i m not getting how to implement nunit test code.could you please help me.
IUserService iservice = this.channel.CreateChannel();
string token = iservice.AuthenticateUser(this.txtUserName.Text, this.txtPwd.Text);
EndpointAddressBuilder builder = new EndpointAddressBuilder(this.channel.Endpoint.Address);
AddressHeader header = AddressHeader.CreateAddressHeader("token", "", token);
builder.Headers.Add(header);
LoginUtility.EndPoint = builder.ToEndpointAddress();
this.channel = new ChannelFactory
iservice = this.channel.CreateChannel();
User response = iservice.GetUserInfoByLoginId(this.txtUserName.Text);
LoginUtility.UserID = response.UserID;
LoginUtility.UserType = response.Type;
Thank you,
Anusha.
Jaganathan BantheswaranPosted Aug 26, 2013, 1:52 AM
You should use mocking for your login.
This post may help you. http://www.prideparrot.com/blog/archive/2011/12/unit_testing_using_nunit_and_rhino_mocks