示例#1
0
        public void TestAuthenticateNegative()
        {
            string UserName = "******";
            string Password = "******";
            string result   = WebApiCaller.GetUserToken(UserName, Password);

            Assert.IsTrue(string.IsNullOrEmpty(result));
        }
示例#2
0
        public void TestGetProducts()
        {
            string UserName = "******";
            string Password = "******";
            string result   = WebApiCaller.GetUserToken(UserName, Password);

            Product[] products = WebApiCaller.GetProducts(result);
            Assert.IsNotNull(products);
        }
示例#3
0
        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"));
            }
        }