public void TestAuthenticateNegative() { string UserName = "******"; string Password = "******"; string result = WebApiCaller.GetUserToken(UserName, Password); Assert.IsTrue(string.IsNullOrEmpty(result)); }
public void TestGetProducts() { string UserName = "******"; string Password = "******"; string result = WebApiCaller.GetUserToken(UserName, Password); Product[] products = WebApiCaller.GetProducts(result); Assert.IsNotNull(products); }
public ActionResult Login(string username, string password) { string access_token = WebApiCaller.GetUserToken(username, password); if (!string.IsNullOrEmpty(access_token)) { System.Web.HttpContext.Current.Session["access_token"] = access_token; return(RedirectToAction("ViewProduct", "Home")); } else { return(RedirectToAction("Login", "Home")); } }