Example #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);
        }
        public void AllOrders_4()
        {
            IUserProfile UserProfileObj = new UserProfile();
            IOrder       OrderObj       = new Order();

            UserProfileObj.SetToken("ABCD");
            OrderObj.SetOrderType("Group");
            OrderTypeTemplate            GroupOrderObj = new GroupOrderTemplate(UserProfileObj, OrderObj);
            List <IOrderBuilderResponse> Output        = GroupOrderObj.FetchAllOrders();

            Assert.AreEqual(Output.Count == 0, true);
        }
        public void AllOrders_3()
        {
            int          ExpectedOutput = -2;
            int          GotOutput      = 0;
            IUserProfile UserProfileObj = new UserProfile();
            IOrder       OrderObj       = new Order();

            OrderObj.SetOrderType("Group");
            UserProfileObj.SetToken(null);
            try
            {
                OrderTypeTemplate            GroupOrderObj = new GroupOrderTemplate(UserProfileObj, OrderObj);
                List <IOrderBuilderResponse> Output        = GroupOrderObj.FetchAllOrders();
            }
            catch (Exception)
            {
                GotOutput = -2;
            }
            Assert.AreEqual(GotOutput, ExpectedOutput);
        }
Example #4
0
        public void CancelledOrders_2()
        {
            int          ExpectedOutput = -2;
            int          GotOutput      = 0;
            IUserProfile UserProfileObj = new UserProfile();
            IOrder       OrderObj       = new Order();

            OrderObj.SetOrderType("Group");
            OrderObj.SetStatusName("Cancelled");
            UserProfileObj.SetToken("");
            try
            {
                OrderTypeTemplate            GroupOrderObj = new GroupOrderTemplate(UserProfileObj, OrderObj);
                List <IOrderBuilderResponse> Output        = GroupOrderObj.FetchCancelledOrderID();
            }
            catch (Exception)
            {
                GotOutput = -2;
            }
            Assert.AreEqual(GotOutput, ExpectedOutput);
        }
        public void AllOrders_2()
        {
            /*
             * Input : Valid Token, valid OrderType and valid StatusName but doesnot exits in dbms
             * Output: "0" rows affected
             */
            int          ExpectedOutput = -2;
            int          GotOutput      = 0;
            IUserProfile UserProfileObj = new UserProfile();
            IOrder       OrderObj       = new Order();

            OrderObj.SetOrderType("Group");
            UserProfileObj.SetToken("");
            try
            {
                OrderTypeTemplate            GroupOrderObj = new GroupOrderTemplate(UserProfileObj, OrderObj);
                List <IOrderBuilderResponse> Output        = GroupOrderObj.FetchAllOrders();
            }
            catch (Exception)
            {
                GotOutput = -2;
            }
            Assert.AreEqual(GotOutput, ExpectedOutput);
        }