public void GetNewShouldRetrieveFilledRoleModel()
 {
     var mock = new RoleServiceMock();
     mock.RoleManagerMock.Setup(m => m.PermissionQuery()).Returns(MembershipTestData.Permissions.Where(p => p.ApplicationId == MembershipTestData.AppId).AsQueryable());
     var result = mock.RoleService.Get(Guid.Empty);
     Assert.IsNotNull(result);
     Assert.AreEqual(0, result.Permissions.First().Index);
     Assert.AreEqual(3, result.Permissions.Last().Index);
 }
        public void GetNewShouldRetrieveFilledRoleModel()
        {
            var mock = new RoleServiceMock();

            mock.RoleManagerMock.Setup(m => m.PermissionQuery()).Returns(MembershipTestData.Permissions.Where(p => p.ApplicationId == MembershipTestData.AppId).AsQueryable());
            var result = mock.RoleService.Get(Guid.Empty);

            Assert.IsNotNull(result);
            Assert.AreEqual(0, result.Permissions.First().Index);
            Assert.AreEqual(3, result.Permissions.Last().Index);
        }
 public void GetShouldRetrieveFilledRoleModel()
 {
     var mock = new RoleServiceMock();
     mock.RoleManagerMock.Setup(m => m.PermissionQuery()).Returns(MembershipTestData.Permissions.Where(p => p.ApplicationId == MembershipTestData.AppId).AsQueryable());
     mock.RoleManagerMock.Setup(m => m.Get(MembershipTestData.GroupAdminRoleId)).Returns(MembershipTestData.GroupAdminRole);
     mock.RoleManagerMock.Setup(m => m.Query()).Returns(MembershipTestData.Roles.AsQueryable());
     var result = mock.RoleService.Get(MembershipTestData.GroupAdminRoleId);
     Assert.IsNotNull(result);
     Assert.AreEqual(0, result.Permissions.First().Index);
     Assert.AreEqual(3, result.Permissions.Last().Index);
     Assert.AreEqual(true, result.Permissions.ElementAt(1).Selected);
 }
        public void GetShouldRetrieveFilledRoleModel()
        {
            var mock = new RoleServiceMock();

            mock.RoleManagerMock.Setup(m => m.PermissionQuery()).Returns(MembershipTestData.Permissions.Where(p => p.ApplicationId == MembershipTestData.AppId).AsQueryable());
            mock.RoleManagerMock.Setup(m => m.Get(MembershipTestData.GroupAdminRoleId)).Returns(MembershipTestData.GroupAdminRole);
            mock.RoleManagerMock.Setup(m => m.Query()).Returns(MembershipTestData.Roles.AsQueryable());
            var result = mock.RoleService.Get(MembershipTestData.GroupAdminRoleId);

            Assert.IsNotNull(result);
            Assert.AreEqual(0, result.Permissions.First().Index);
            Assert.AreEqual(3, result.Permissions.Last().Index);
            Assert.AreEqual(true, result.Permissions.ElementAt(1).Selected);
        }