public void TestValidateUser() { String userName = Convert.ToString(TestContext.DataRow["UserName"]); String password = Convert.ToString(TestContext.DataRow["Password"]); String expectedResult = Convert.ToString(TestContext.DataRow["Result"]); IUser user = new User { UserName = userName, Password = password }; LoginModel.Login login = new LoginModel.Login(user); String actualResult = login.ValidateUser(); Assert.AreEqual(expectedResult, actualResult); }
/// <summary> /// Summary description for ValidateUser /// </summary> public void ProcessRequest(HttpContext context) { HttpRequest request = context.Request; HttpResponse response = context.Response; LoginModel.Login login = new LoginModel.Login(new User { UserName = request.QueryString["userName"], Password = request.QueryString["password"] }); JavaScriptSerializer serializer = new JavaScriptSerializer(); String jsonString = serializer.Serialize(new { result = login.ValidateUser() }); response.Write(jsonString); response.ContentType = "application/json"; }
/// <summary> /// Summary description for ValidateUser /// </summary> public void ProcessRequest(HttpContext context) { HttpRequest request = context.Request; HttpResponse response = context.Response; LoginModel.Login login = new LoginModel.Login(new User { UserName = request.QueryString["userName"], Password = request.QueryString["password"] }); JavaScriptSerializer serializer = new JavaScriptSerializer(); String jsonString = serializer.Serialize(new { result = login.ValidateUser() }); response.Write(jsonString); response.ContentType = "application/json"; }
public void TestValidateUser() { String userName = Convert.ToString(TestContext.DataRow["UserName"]); String password = Convert.ToString(TestContext.DataRow["Password"]); String expectedResult = Convert.ToString(TestContext.DataRow["Result"]); IUser user = new User { UserName = userName, Password = password }; LoginModel.Login login = new LoginModel.Login(user); String actualResult = login.ValidateUser(); Assert.AreEqual(expectedResult, actualResult); }