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

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

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