Skip to content

Commit dea78c5

Browse files
committed
Update UserServiceTests.cs
1 parent d06ff5f commit dea78c5

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/Umbraco.Tests/Services/UserServiceTests.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,24 @@ public void Can_Remove_Section_From_All_Assigned_Users()
451451

452452
}
453453

454+
[Test]
455+
public void Can_Add_Section_To_All_Users()
456+
{
457+
var userType = ServiceContext.UserService.GetUserTypeByAlias("admin");
458+
459+
var user1 = ServiceContext.UserService.CreateUserWithIdentity("test1", "test1@test.com", userType);
460+
var user2 = ServiceContext.UserService.CreateUserWithIdentity("test2", "test2@test.com", userType);
461+
462+
//now add the section to all users
463+
ServiceContext.UserService.AddSectionToAllUsers("test");
464+
465+
//assert
466+
var result1 = ServiceContext.UserService.GetUserById((int)user1.Id);
467+
var result2 = ServiceContext.UserService.GetUserById((int)user2.Id);
468+
Assert.IsFalse(result1.AllowedSections.Contains("test"));
469+
Assert.IsFalse(result2.AllowedSections.Contains("test"));
470+
}
471+
454472
[Test]
455473
public void Get_By_Profile_Username()
456474
{
@@ -512,4 +530,4 @@ public void Get_User_By_Username()
512530
Assert.That(updatedItem.AllowedSections.Count(), Is.EqualTo(0));
513531
}
514532
}
515-
}
533+
}

0 commit comments

Comments
 (0)