public void GetTokenList_4()
        {
            UserProfile UserProfileObj = new UserProfile();

            UserProfileObj.SetEmail("*****@*****.**");
            UserProfileObj.SetPassword("aA!12345");
            List <string> TokenList = null;

            try
            {
                TokenList = new SecurityDataLayer(UserProfileObj).GetTokenList();
                if (TokenList.Count == 0)
                {
                    // token count = 0 means that the account is not logged in or all sessions destroyed
                    // generate the token
                    LoginUserReponse response = new UserActions().LoginUserAction(UserProfileObj);
                    TokenList = new SecurityDataLayer(UserProfileObj).GetTokenList();
                }
            }
            catch (Exception)
            {
                TokenList = null;
            }
            Assert.AreEqual(TokenList.Count > 0, true);
        }
        public void FetchUserList_6()
        {
            UserProfile UserProfileObj = new UserProfile();

            UserProfileObj.SetEmail("*****@*****.**");
            List <string> token = new SecurityDataLayer(UserProfileObj).GetTokenList();

            if (token.Count == 0)
            {
                // token count = 0 means that the account is not logged in or all sessions destroyed
                // generate the token
                UserProfileObj.SetPassword("aA!12345");
                // this will generate the token in db
                new UserActions().LoginUserAction(UserProfileObj);
                token = new SecurityDataLayer(UserProfileObj).GetTokenList();
            }
            UserProfileObj.SetToken(token[token.Count - 1]);
            string Query = "demouser";

            ExpectedOutput = "Success";
            GotOutput      = "";
            try
            {
                UserTemplate <IUserProfile> NormalTemplate = new NormalUserTemplate(UserProfileObj, Query);
                List <IUserProfile>         profiles       = NormalTemplate.FetchList();
                GotOutput = "Success";
            }
            catch (Exception ex)
            {
                GotOutput = "FAIL";
            }

            Assert.AreEqual(ExpectedOutput, GotOutput);
        }
        public void OrderDetailsByTypeAndStatus_10()
        {
            IUserProfile UserProfileObj = new UserProfile();

            UserProfileObj.SetEmail("*****@*****.**");
            List <string> token = new SecurityDataLayer(UserProfileObj).GetTokenList();

            if (token.Count == 0)
            {
                // token count = 0 means that the account is not logged in or all sessions destroyed
                // generate the token
                UserProfileObj.SetPassword("Root@123");
                LoginUserReponse response = new UserActions().LoginUserAction(UserProfileObj);
                token = new SecurityDataLayer(UserProfileObj).GetTokenList();
            }
            UserProfileObj.SetToken(token[token.Count - 1].ToString());
            IOrder OrderObj = new Order();

            OrderObj.SetOrderType("Individual");
            OrderObj.SetStatusName("ABCD");
            IOrderDetailsDataLayer OrderDetailsDataLayerObj = new OrderDetailsDataLayer(UserProfileObj, OrderObj);
            DataSet Output = OrderDetailsDataLayerObj.FetchOrderDetailsByTypeAndStatus();

            Assert.AreEqual(Output.Tables[0].Rows.Count == 0, true);
        }
        public void OrderDetailsByTypeAndStatus_9()
        {
            int          ExpectedOutput = -2;
            int          GotOutput      = 0;
            IUserProfile UserProfileObj = new UserProfile();

            UserProfileObj.SetEmail("*****@*****.**");
            List <string> token = new SecurityDataLayer(UserProfileObj).GetTokenList();

            if (token.Count == 0)
            {
                // token count = 0 means that the account is not logged in or all sessions destroyed
                // generate the token
                UserProfileObj.SetPassword("Root@123");
                LoginUserReponse response = new UserActions().LoginUserAction(UserProfileObj);
                token = new SecurityDataLayer(UserProfileObj).GetTokenList();
            }
            UserProfileObj.SetToken(token[token.Count - 1].ToString());
            IOrder OrderObj = new Order();

            OrderObj.SetOrderType("Individual");
            OrderObj.SetStatusName("");
            IOrderDetailsDataLayer OrderDetailsDataLayerObj = new OrderDetailsDataLayer(UserProfileObj, OrderObj);

            try
            {
                DataSet Output = OrderDetailsDataLayerObj.FetchOrderDetailsByTypeAndStatus();
            }
            catch (Exception)
            {
                GotOutput = -2;
            }
            Assert.AreEqual(GotOutput, ExpectedOutput);
        }
예제 #5
0
        public void AuthenticateUser_4()
        {
            UserProfile UserProfileObj = new UserProfile();

            UserProfileObj.SetEmail("*****@*****.**");
            List <string> token = new SecurityDataLayer(UserProfileObj).GetTokenList();

            if (token.Count == 0)
            {
                // token count = 0 means that the account is not logged in or all sessions destroyed
                // generate the token
                UserProfileObj.SetPassword("aA!12345");
                LoginUserReponse response = new UserActions().LoginUserAction(UserProfileObj);
                token = new SecurityDataLayer(UserProfileObj).GetTokenList();
            }
            UserProfileObj.SetToken(token[token.Count - 1].ToString());
            DataSet GotOutput;

            try
            {
                GotOutput = new SecurityDataLayer(UserProfileObj).GetUserToken();
            }
            catch (Exception)
            {
                GotOutput = null;
            }
            Assert.AreEqual(int.Parse(GotOutput.Tables[0].Rows[0][0].ToString()) > 0, true);
        }
        public void GetTokenList_3()
        {
            UserProfile UserProfileObj = new UserProfile();

            UserProfileObj.SetEmail("*****@*****.**");
            List <string> TokenList = null;

            try
            {
                TokenList = new SecurityDataLayer(UserProfileObj).GetTokenList();
            }
            catch (Exception ex)
            {
                GotOutput = ex.Message.ToString();
            }
            Assert.AreEqual(TokenList.Count == 0, true);
        }
        public void GetTokenList_2()
        {
            UserProfile UserProfileObj = new UserProfile();

            UserProfileObj.SetEmail("");
            ExpectedOutput = "FAIL";
            try
            {
                List <string> TokenList = new SecurityDataLayer(UserProfileObj).GetTokenList();
                GotOutput = "Success";
            }
            catch (Exception ex)
            {
                GotOutput = "FAIL";
            }
            Assert.AreEqual(ExpectedOutput, GotOutput);
        }
예제 #8
0
        public void AuthenticateUser_3()
        {
            UserProfile UserProfileObj = new UserProfile();

            UserProfileObj.SetToken("absca");
            DataSet GotOutput;

            try
            {
                GotOutput = new SecurityDataLayer(UserProfileObj).GetUserToken();
            }
            catch (Exception)
            {
                GotOutput = null;
            }
            Assert.AreEqual(GotOutput.Tables[0].Rows[0][0].ToString(), "0");
        }
예제 #9
0
        public void AuthenticateUser_2()
        {
            UserProfile UserProfileObj = new UserProfile();

            UserProfileObj.SetToken("");
            DataSet GotOutput;

            try
            {
                GotOutput = new SecurityDataLayer(UserProfileObj).GetUserToken();
            }
            catch (Exception)
            {
                GotOutput = null;
            }
            Assert.AreEqual(null, GotOutput);
        }
예제 #10
0
        public void FetchAdminListTest_3()
        {
            UserProfile UserProfileObj = new UserProfile();

            UserProfileObj.SetEmail("*****@*****.**");
            List <string> token = new SecurityDataLayer(UserProfileObj).GetTokenList();

            if (token.Count == 0)
            {
                // token count = 0 means that the account is not logged in or all sessions destroyed
                // generate the token
                UserProfileObj.SetPassword("aA!12345");
                // login the user
                new UserActions().LoginUserAction(UserProfileObj);
                token = new SecurityDataLayer(UserProfileObj).GetTokenList();
            }
            UserProfileObj.SetToken(token[token.Count - 1].ToString());
            UserTemplate <IUserProfile> AdminUserTemplate = new AdminUserTemplate(UserProfileObj);
            List <IUserProfile>         Output            = AdminUserTemplate.FetchList();

            Assert.AreEqual(Output.Count > 0, true);
        }