Exemplo n.º 1
0
        public void Delete_NotExistId_ReturnFalse()
        {
            mockUnitOfWork.Setup(u => u.ApplicationGroups.GetById(0));
            var result = manager.Delete(0);

            Assert.IsFalse(result);
        }
        public async Task AddAndDeleteGroup()
        {
            await GroupManager.Load();

            IGroup leerlingen = GroupManager.Root.Find("Leerlingen");

            Assert.IsTrue(leerlingen != null);

            Group newGroup = new Group(leerlingen);

            newGroup.Name        = "unittestgroup";
            newGroup.Description = "may be deleted";
            newGroup.Type        = GroupType.Group;
            newGroup.Code        = "UTGRP";
            bool result = await GroupManager.Save(newGroup);

            Assert.IsTrue(result);

            await GroupManager.Reload();

            IGroup testGroup = GroupManager.Root.Find("unittestgroup");

            Assert.IsNotNull(testGroup);
            Assert.IsNotNull(testGroup.Parent);
            Assert.IsTrue(testGroup.Parent.Name == "Leerlingen");

            await GroupManager.Delete(testGroup);

            await GroupManager.Reload();

            testGroup = GroupManager.Root.Find("unittestgroup");
            Assert.IsNull(testGroup);
        }
 public JsonResult Delete(Int64 Id)
 {
     if (groupManager.Delete(Id))
     {
         return(Json(new { info = "Deleted", status = true }, JsonRequestBehavior.AllowGet));
     }
     return(Json(new { info = "Not Deleted", status = false }, JsonRequestBehavior.AllowGet));
 }
        public void Testgroupdelete()
        {
            var gstore = new GroupStore <IdentityGroup>();
            var gm     = new GroupManager <IdentityGroup>(gstore);
            var gr     = gm.FindByName("group3");

            if (gr != null)
            {
                gm.Delete(gr);
            }
        }
Exemplo n.º 5
0
        public object Delete(long groupId)
        {
            logger.Log(LogLevel.Debug, $"GroupController.Delete({groupId})"); //object to json

            try
            {
                GroupManager.Delete(groupId);
                return(Json(new Response(0, "Success"), JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                logger.Log(LogLevel.Error, $"GroupController.Delete({groupId}) - {ex}"); //object to json
                //изменить http status code
                return(Json(new Response(100, ex.Message), JsonRequestBehavior.AllowGet));
            }
        }
Exemplo n.º 6
0
        public object Delete(Group group)
        {
            logger.Log(LogLevel.Debug, $"GroupController.Delete({group})"); //object to json

            try
            {
                GroupManager.Delete(group);
                return(new Response(0, "Success"));
            }
            catch (Exception ex)
            {
                logger.Log(LogLevel.Error, $"GroupController.Delete({group}) - {ex}"); //object to json
                //изменить http status code
                return(new Response(100, ex.Message));
            }
        }