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); }
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 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); }
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); }
public Security(IUserProfile UserProfileObj) { this.UserProfileObj = UserTemplate.FetchParticularProfile(UserProfileObj); SecurityObjDataLayer = new SecurityDataLayer(UserProfileObj); }