Combined test user/group test objects created for repository and service tests.

This commit is contained in:
Andy Butland
2020-10-07 15:47:26 +02:00
parent 78c4a17503
commit 31b2f1ec4f
4 changed files with 70 additions and 51 deletions

View File

@@ -209,6 +209,16 @@ namespace Umbraco.Tests.Common.Builders
return list;
}
public static User CreateUser(string suffix = "")
{
return new UserBuilder()
.WithIsApproved(true)
.WithName("TestUser" + suffix)
.WithLogin("TestUser" + suffix, "testing")
.WithEmail("test" + suffix + "@test.com")
.Build();
}
int? IWithIdBuilder.Id
{
get => _id;

View File

@@ -122,11 +122,11 @@ namespace Umbraco.Tests.Common.Builders
return userGroup;
}
public static UserGroup CreateUserGroup(string suffix = "", string[] permissions = null, string[] allowedSections = null)
public static UserGroup CreateUserGroup(string alias = "testGroup", string name = "Test Group", string suffix = "", string[] permissions = null, string[] allowedSections = null)
{
return (UserGroup)new UserGroupBuilder()
.WithAlias("testUserGroup" + suffix)
.WithName("TestUserGroup" + suffix)
.WithAlias(alias + suffix)
.WithName(name + suffix)
.WithPermissions(permissions ?? new[] { "A", "B", "C" })
.WithAllowedSections(allowedSections ?? new[] { "content", "media" })
.Build();