Exemplo n.º 1
0
 public void testAuth()
 {
     try
     {
         var result = dal.AuthenticateUser("dfsafd", "13432432");
         Assert.IsNotNull(result);
     }
     catch (Exception ex)
     {
         if (ex.InnerException.GetType() == typeof(WebException) &&
             ((WebException)ex.InnerException).Status.ToString() == "ConnectFailure")
         {
             Assert.Fail();
         }
     }
 }
Exemplo n.º 2
0
        public bool AuthenticateUser(string id, string pass)
        {
            var response = DAL.AuthenticateUser(id, pass);

            if (response.IsSuccessStatusCode)
            {
                var keyValue = JsonConvert.DeserializeObject <Dictionary <string, string> >(response.Content.ReadAsStringAsync().Result);

                string token = null;

                keyValue.TryGetValue("token", out token);

                user = new VOUser()
                {
                    Token = token
                };

                return(true);
            }
            return(false);
        }