Esempio n. 1
0
        public void TestUserGroupServices_Delete_Group()
        {
            var sa = GetUserSessionModel("*****@*****.**");

            var toplevel = this.TContext.Groups.Where(g => g.Name == "Test Daikin").FirstOrDefault();


            var before = this.TContext.Groups.Where(g => g.Name == "Test Dallas").FirstOrDefault();

            var result = service.GroupCreate(sa, "Test Dallas DownTown", before.GroupId);

            var newgrp = this.TContext.Groups.Where(g => g.Name == "Test Dallas DownTown").FirstOrDefault();

            Assert.IsTrue(newgrp != null);

            result = service.GroupDelete(sa, newgrp.GroupId);

            newgrp = this.TContext.Groups.Where(g => g.Name == "Test Dallas DownTown").FirstOrDefault();

            var toplevelafter = this.TContext.Groups.Where(g => g.Name == "Test Daikin").FirstOrDefault();

            var after = this.TContext.Groups.Where(g => g.Name == "Test Dallas").FirstOrDefault();

            // make nothing has changed
            Assert.IsTrue(toplevelafter.ChildrenCountDeep == toplevel.ChildrenCountDeep);

            Assert.IsTrue(before.ChildrenCount == after.ChildrenCount);

            Assert.IsTrue(newgrp == null);
        }
        public ActionResult UserGroupsGroupDelete(long groupId)
        {
            if (this.CurrentUser.IsGroupOwner)
            {
                this.ServiceResponse = groupsService.GroupDelete(this.CurrentUser, groupId);
            }

            return(UserGroupsList(null));
        }