예제 #1
0
        public void RetrievesByUserId_Ok()
        {
            var userId = UserHelper.Retrieves().FirstOrDefault(r => r.UserName == "Admin").Id;
            var groups = GroupHelper.RetrievesByUserId(userId);

            Assert.NotNull(groups);
        }
예제 #2
0
        public void RetrieveRolesByGroupId_Ok()
        {
            var id = RoleHelper.Retrieves().FirstOrDefault(r => r.RoleName == "Administrators").Id;

            GroupHelper.SaveByRoleId(id, GroupHelper.Retrieves().Select(g => g.Id));
            Assert.NotEmpty(RoleHelper.RetrievesByGroupId(GroupHelper.Retrieves().Where(g => g.GroupName == "Admin").FirstOrDefault().Id).Where(r => r.Checked == "checked"));
        }
예제 #3
0
        public void SaveByGroupId_Ok()
        {
            var groupId = GroupHelper.Retrieves().FirstOrDefault(g => g.GroupName == "Admin").Id;
            var id      = UserHelper.Retrieves().FirstOrDefault(u => u.UserName == "Admin").Id;

            Assert.True(UserHelper.SaveByGroupId(groupId, new string[] { id }));

            var users = UserHelper.RetrievesByGroupId(groupId);

            Assert.NotEmpty(users.Where(u => u.Checked == "checked"));

            Assert.True(UserHelper.SaveByGroupId(groupId, new string[0]));
        }
예제 #4
0
        public void SaveAndDelete_Ok()
        {
            var g = new Group()
            {
                GroupCode = "002", GroupName = "UnitTest", Description = "UnitTestSave"
            };

            // insert
            Assert.True(GroupHelper.Save(g));

            // update
            Assert.True(GroupHelper.Save(g));

            // delete
            Assert.True(GroupHelper.Delete(new string[] { g.Id }));
        }
예제 #5
0
        public void SaveByGroupId_Ok()
        {
            var gId = GroupHelper.Retrieves().FirstOrDefault(g => g.GroupName == "Admin").Id;

            RoleHelper.SaveByGroupId(gId, RoleHelper.Retrieves().Where(r => r.RoleName == "Administrators").Select(r => r.Id));
        }
예제 #6
0
 public void Retrieves_Ok()
 {
     Assert.NotEmpty(GroupHelper.Retrieves());
 }
예제 #7
0
 public void RetrievesByUserName_Ok()
 {
     Assert.NotNull(GroupHelper.RetrievesByUserName("Admin"));
 }
예제 #8
0
        public void SaveByRoleId_Ok()
        {
            var roleId = RoleHelper.Retrieves().FirstOrDefault(r => r.RoleName == "Administrators").Id;

            Assert.True(GroupHelper.SaveByRoleId(roleId, GroupHelper.Retrieves().Select(g => g.Id)));
        }
예제 #9
0
        public void SaveByUserId_Ok()
        {
            var userId = UserHelper.Retrieves().FirstOrDefault(r => r.UserName == "Admin").Id;

            Assert.True(GroupHelper.SaveByUserId(userId, GroupHelper.Retrieves().Select(g => g.Id)));
        }
예제 #10
0
        public void RetrievesByRoleId_Ok()
        {
            var groups = GroupHelper.RetrievesByRoleId(RoleHelper.Retrieves().Where(r => r.RoleName == "Administrators").First().Id);

            Assert.NotEmpty(groups);
        }