示例#1
0
        public void CancelledOrders_1()
        {
            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("Group");
            OrderObj.SetStatusName("Cancelled");
            OrderTypeTemplate            GroupOrderObj = new GroupOrderTemplate(UserProfileObj, OrderObj);
            List <IOrderBuilderResponse> Output        = GroupOrderObj.FetchCancelledOrderID();

            Assert.AreEqual(Output.Count > 0, true);
        }
示例#2
0
        public APIResponse RecoverPasswordAction()
        {
            string Email = UserProfileObj.GetEmail();

            try
            {
                string      FPToken        = SHA256.Instance().GetUniqueKey(100);
                APIResponse ApiResponseObj = new UserActions(UserProfileObj).RecoverPasswordAction();
                if (ApiResponseObj == APIResponse.OK)
                {
                    // send the mail
                }
                return(APIResponse.OK);
            }
            catch (MySqlException mse)
            {
                Logger.Instance().Log(Warn.Instance(), mse);
                throw mse;
            }
            catch (Exception ex)
            {
                Logger.Instance().Log(Warn.Instance(), ex);
                throw ex;
            }
        }
示例#3
0
        public void BuildOrder_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");
            OrderDetailsTemplate         UnpaidOrdersObj = new UnpaidOrdersTemplate(UserProfileObj, OrderObj);
            List <IOrderBuilderResponse> Output          = UnpaidOrdersObj.BuildOrder();

            Assert.AreEqual(Output.Count == 0, true);
        }
示例#4
0
        public void BuildOrder_6()
        {
            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("");
            OrderObj.SetStatusName("Unpaid");
            try
            {
                OrderDetailsTemplate         UnpaidOrdersObj = new UnpaidOrdersTemplate(UserProfileObj, OrderObj);
                List <IOrderBuilderResponse> Output          = UnpaidOrdersObj.BuildOrder();
            }
            catch (Exception)
            {
                GotOutput = -2;
            }
            Assert.AreEqual(GotOutput, ExpectedOutput);
        }
示例#5
0
        public void BuildOrderDate_1()
        {
            string       Date           = "2018-08-02 02:40:32";
            DateTime     ExpectedOutput = Convert.ToDateTime(Date);
            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("Group");
            OrderObj.SetOrderID(32);
            OrderBuilderAbstract OrderBuilderObj = new OrderBuilder(UserProfileObj, OrderObj);
            DateTime             GotOutput       = OrderBuilderObj.BuildOrderDate();

            Assert.AreEqual(GotOutput, ExpectedOutput);
        }
        public void BuildOrderItemCount_9()
        {
            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("Group");
            OrderObj.SetOrderID(11111);
            OrderBuilderAbstract OrderBuilderObj = new OrderBuilder(UserProfileObj, OrderObj);
            int Output = OrderBuilderObj.BuildOrderItemCount();

            Assert.AreEqual(Output == 0, true);
        }
        public void BuildOrderStatus_7()
        {
            string       ExpectedOutput = null;
            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("ABCD");
            OrderObj.SetOrderID(35);
            OrderBuilderAbstract OrderBuilderObj = new OrderBuilder(UserProfileObj, OrderObj);
            string GotOutput = OrderBuilderObj.BuildOrderStatus();

            Assert.AreEqual(GotOutput, ExpectedOutput);
        }