Example #1
0
        public void DeleteRole_Success_Test()
        {
            //get all the roles from the db
            List <Role> previousRoles = rolesBL.GetAllRoles().ToList <Role>();

            //successfully delete role
            Role r = rolesBL.GetRole(13);

            rolesBL.DeleteRole(r.RoleID);

            List <Role> expectedRoles = new List <Role>();

            expectedRoles.AddRange(previousRoles); //add the previous Roles to the list
            expectedRoles.RemoveAll(x => x.RoleID == r.RoleID);

            List <Role> actualRoles = rolesBL.GetAllRoles().ToList <Role>();

            //check if expected roles with the actual roles are equal
            AreListsEqual(expectedRoles, actualRoles);
        }