Ejemplo n.º 1
0
        public void RemoveCategoryWhenCategoryNotExists()
        {
            DoSignInToAdmin();
            adminServiceSession = (SystemAdminService)marketSession.GetSystemAdminService(userServiceSession);
            MarketAnswer ans = adminServiceSession.RemoveCategory("bad item");

            Assert.AreEqual((int)EditCategoryStatus.CategoryNotExistsInSystem, ans.Status);
        }
Ejemplo n.º 2
0
        public void AddCategoryWhenCategoryAlreadyExists()
        {
            DoSignInToAdmin();
            adminServiceSession = (SystemAdminService)marketSession.GetSystemAdminService(userServiceSession);
            MarketAnswer ans = adminServiceSession.AddCategory("WanderlandItems");

            Assert.AreEqual((int)EditCategoryStatus.CategoryAlradyExist, ans.Status);
        }
Ejemplo n.º 3
0
 public void NotSystemAdminTest()
 {
     userServiceSession.EnterSystem();
     userServiceSession.SignIn("Arik2", "123");
     adminServiceSession = (SystemAdminService)marketSession.GetSystemAdminService(userServiceSession);
     Assert.AreEqual((int)EditPolicyStatus.NoAuthority, adminServiceSession.CreatePolicy("Global", null, "Quantity <=", "5", "0").Status);
 }
Ejemplo n.º 4
0
        public void ViewLogSuccessTest()
        {
            var adminService = marketSession.GetSystemAdminService(userServiceSession);
            var answer       = adminService.ViewLog();

            Assert.AreEqual((int)ViewSystemLogStatus.Success, answer.Status);
            Assert.AreEqual(10, answer.ReportList.Length);
        }
Ejemplo n.º 5
0
 public void PurchaseHistoryOfUserTest()
 {
     DoSignInToAdmin();
     adminServiceSession = (SystemAdminService)marketSession.GetSystemAdminService(userServiceSession);
     string[] expectedHistory =
     {
         new PurchaseHistory(userNameToView1, "Health Potion", storeNameToView1, "Immediate", 2, 11.5, "29/12/2018").ToString(),
         new PurchaseHistory(userNameToView1, "INT Potion",    storeNameToView2, "Lottery",   2,  8.0, "29/12/2018").ToString(),
         new PurchaseHistory(userNameToView1, "Mana Potion",   storeNameToView2, "Lottery",   3, 12.0, "29/12/2018").ToString(),
     };
     Assert.AreEqual((int)ViewPurchaseHistoryStatus.Success, adminServiceSession.ViewPurchaseHistoryByUser(userNameToView1).Status);
     Assert.IsTrue(adminServiceSession.ViewPurchaseHistoryByUser(userNameToView1).ReportList.SequenceEqual(expectedHistory));
     Assert.IsFalse(MarketException.HasErrorRaised());
 }
        public void ViewEntranceReportTest()
        {
            var adminService = marketSession.GetSystemAdminService(userServiceSession);
            var answer       = adminService.GetEntranceDetails();

            Assert.AreEqual((int)GetEntranceDetailsEnum.Success, answer.Status);
            Assert.AreEqual(1, answer.ReportList.Length);
            Assert.AreEqual("Number: 1 Date: " + DateTime.Now.Date, answer.ReportList[0]);
        }
Ejemplo n.º 7
0
        public void ViewErrorSuccessTest()
        {
            var answer = userServiceSession.SignIn("Moshe", "1234");

            Assert.AreEqual((int)SignInStatus.NoUserFound, answer.Status);
            answer = userServiceSession.SignIn("Arik1", "123");
            Assert.AreEqual((int)SignInStatus.Success, answer.Status);
            var adminService = marketSession.GetSystemAdminService(userServiceSession);

            answer = adminService.ViewError();
            Assert.AreEqual((int)ViewSystemLogStatus.Success, answer.Status);
            Assert.AreEqual(1, answer.ReportList.Length);
        }
 public void MarketBuilder()
 {
     MarketDB.Instance.InsertByForce();
     marketSession       = MarketYard.Instance;
     userServiceSession  = (UserService)marketSession.GetUserService();
     userServiceSession2 = (UserService)marketSession.GetUserService();
     userServiceSession3 = (UserService)marketSession.GetUserService();
     userServiceSession2.EnterSystem();
     userServiceSession3.EnterSystem();
     userServiceSession2.SignIn(sysadmin, pass);
     sysadminSession = marketSession.GetSystemAdminService(userServiceSession2);
     userServiceSession.EnterSystem();
     orderServiceSession = (OrderService)marketSession.GetOrderService(ref userServiceSession);
     storeServiceSession = (StoreShoppingService)marketSession.GetStoreShoppingService(ref userServiceSession);
 }
Ejemplo n.º 9
0
 public void CantLoginToDeletedUserTest()
 {
     deletedUserSession = (UserService)marketSession.GetUserService();
     deletedUserSession.EnterSystem();
     deletedUserSession.SignUp("DeleteMe", "no-where", "123", "12345678");
     ToSignIn(adminName, adminPass);
     adminServiceSession = (SystemAdminService)marketSession.GetSystemAdminService(userServiceSession);
     adminServiceSession.RemoveUser("DeleteMe");
     deletedUserSession2 = (UserService)marketSession.GetUserService();
     deletedUserSession2.EnterSystem();
     Assert.AreEqual((int)SignInStatus.NoUserFound, deletedUserSession2.SignIn("DeleteMe", "123").Status);
 }
Ejemplo n.º 10
0
 public void RemoveUserSoleOwnerTest()
 {
     DoSignInToAdmin();
     adminServiceSession = (SystemAdminService)marketSession.GetSystemAdminService(userServiceSession);
     Assert.AreEqual((int)RemoveUserStatus.Success, adminServiceSession.RemoveUser(toRemoveUserNameSoleOwner).Status);
 }
Ejemplo n.º 11
0
 public void GetAdminService(IUserService userService)
 {
     _systemAdminService = _market.GetSystemAdminService(userService);
 }