public void DeleteTest()
        {
            //Arrange
            var seedDB = new List <CustomerModelDAL>();
            var seed   = new CustomerModelDAL
            {
                Email     = "*****@*****.**",
                Password  = PasswordHelperTool.PasswordSHA256Hasher("password"),
                FirstName = "First",
                LastName  = "Last"
            };

            seedDB.Add(seed);
            var controller = new CustomerUsersLogic(new CustomerDALStub(seedDB));
            var rightInput = "*****@*****.**";
            var wrongInput = "";

            //Act
            var result1 = controller.Delete(rightInput);
            var result2 = controller.Delete(wrongInput);

            //Assert
            Assert.IsTrue(result1 && !result2);
        }
Ejemplo n.º 2
0
        public JsonResult Delete(string userName)
        {
            if (Session["LoggedIn"] == null || Session["LoggedIn"].Equals(false))
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }

            var result = _customerUsersLogic.Delete(userName);

            if (result)
            {
                return(Json(true, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(false, JsonRequestBehavior.AllowGet));
            }
        }