Example #1
0
        public void Remove_Manager_Test2()
        {
            Register.Registration("ben", "123456", UserId_Ben);
            AssignStoreOwner.assignStoreOwner(UserId_Orel, "Victory", "nati");
            LogIn.Login("nati", "123456", UserId_Nati);
            Assert.AreEqual(AssignStoreManager.AsssignManager(UserId_Nati, "Victory", "ben", Privileges1), true);

            Assert.AreEqual(RemoveStoreManager.removeStoreManager(UserId_Nati, "Victory", "ben"), true);
        }
Example #2
0
        public void Remove_Grandson_Test()
        {
            Register.Registration("ben", "123456", UserId_Ben);
            AssignStoreOwner.assignStoreOwner(UserId_Orel, "Victory", "nati");
            LogIn.Login("nati", "123456", UserId_Nati);
            Assert.AreEqual(AssignStoreManager.AsssignManager(UserId_Nati, "Victory", "ben", Privileges1), true);

            Assert.Throws <ErrorMessageException>(() => RemoveStoreManager.removeStoreManager(UserId_Orel, "Victory", "ben"));
        }
Example #3
0
 public void DoubleRemoveTest()
 {
     Assert.AreEqual(RemoveStoreManager.removeStoreManager(UserId_Orel, "Victory", "saar"), true);
     Assert.Throws <ErrorMessageException>(() => RemoveStoreManager.removeStoreManager(UserId_Orel, "Victory", "saar"));
 }
Example #4
0
 public void Remove_NotExisted_Child_Test()
 {//when the system check if the username exist -if not it returns null->null reference
     Register.Registration("ben", "123456", UserId_Ben);
     Assert.Throws <ErrorMessageException>(() => RemoveStoreManager.removeStoreManager(UserId_Orel, "Victory", "ben"));
 }
Example #5
0
 public void RemoveChildTest()
 {
     Assert.AreEqual(RemoveStoreManager.removeStoreManager(UserId_Orel, "Victory", "saar"), true);
 }
        public void ReadFromStateFile(string Path)
        {
            string line;
            string FunctionName;

            try
            {
                int          userId = CreateAndGetUser.CreateUser();
                StreamReader sr     = new StreamReader(Path + ".txt");
                line = sr.ReadLine();
                while (line != null)
                {
                    string[] funcAndParam = line.Split(':');
                    FunctionName = funcAndParam[0].Trim();
                    string[] param = funcAndParam[1].Split(',');
                    switch (FunctionName)
                    {
                    case "Login":
                    {
                        LogIn.Login(param[0], param[1], userId);
                        break;
                    }

                    case "Register":
                    {
                        Register.Registration(param[0], param[1], userId);
                        break;
                    }

                    case "SaveProductToCart":
                    {
                        SaveProductToCart.SaveProduct(int.Parse(param[0]), userId, int.Parse(param[1]));
                        break;
                    }

                    case "Edit":
                    {
                        WatchAndEdit.Edit(param[0], int.Parse(param[1]), userId);
                        break;
                    }

                    case "Logout":
                    {
                        LogOut.Logout(userId);
                        break;
                    }

                    case "OpenStore":
                    {
                        OpenStore.openStore(param[0], userId);
                        break;
                    }

                    case "AssignStoreOwner":
                    {
                        AssignStoreOwner.assignStoreOwner(userId, param[1], param[2]);
                        break;
                    }

                    case "AssignStoreManager":
                    {
                        string[] boolArray  = param[3].Split(';');
                        bool[]   privileges = new bool[7];
                        int      index      = 0;
                        foreach (string X in boolArray)
                        {
                            if (X.Equals("T"))
                            {
                                privileges[index] = true;
                            }
                            else
                            {
                                privileges[index] = false;
                            }

                            index++;
                        }

                        AssignStoreManager.AsssignManager(userId, param[1], param[2], privileges);
                        break;
                    }

                    case "RemoveStoreManager":
                    {
                        RemoveStoreManager.removeStoreManager(userId, param[1], param[2]);
                        break;
                    }

                    case "AcceptAppointment":
                    {
                        HandlerRequestAppointment.AcceptAppointment(param[0], userId, param[2]);
                        break;
                    }

                    case "DeclineAppointment":
                    {
                        HandlerRequestAppointment.DeclineAppointment(param[0], userId, param[2]);
                        break;
                    }

                    case "RemoveUserFromSystem":
                    {
                        RemoveUserFromSystem.RemoveUser(userId, param[1]);
                        break;
                    }
                    }

                    line = sr.ReadLine();
                }
                sr.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }