* Update gitignore * Move csproj * Update project references * Update solutions * Update build scripts * Tests used to share editorconfig with projects in src * Fix broken tests. * Stop copying around .editorconfig merged root one with linting * csharp_style_expression_bodied -> suggestion * Move StyleCop rulesets to matching directories and update shared build properties * Remove legacy build files, update NuGet.cofig and solution files * Restore myget source * Clean up .gitignore * Update .gitignore * Move new test classes to tests after merge * Gitignore + nuget config * Move new test Co-authored-by: Ronald Barendse <ronald@barend.se>
54 lines
1.8 KiB
C#
54 lines
1.8 KiB
C#
// Copyright (c) Umbraco.
|
|
// See LICENSE for more details.
|
|
|
|
using System.Linq;
|
|
using NUnit.Framework;
|
|
using Umbraco.Cms.Core.Models.Membership;
|
|
using Umbraco.Cms.Tests.Common.Builders;
|
|
using Umbraco.Cms.Tests.Common.Builders.Extensions;
|
|
|
|
namespace Umbraco.Cms.Tests.UnitTests.Umbraco.Tests.Common.Builders
|
|
{
|
|
[TestFixture]
|
|
public class UserGroupBuilderTests
|
|
{
|
|
[Test]
|
|
public void Is_Built_Correctly()
|
|
{
|
|
// Arrange
|
|
const int testId = 10;
|
|
const string testAlias = "test";
|
|
const string testName = "Test";
|
|
const int testUserCount = 11;
|
|
const string testIcon = "icon";
|
|
const string testPermissions = "abc";
|
|
const int testStartContentId = 3;
|
|
const int testStartMediaId = 8;
|
|
|
|
var builder = new UserGroupBuilder();
|
|
|
|
// Act
|
|
IUserGroup userGroup = builder
|
|
.WithId(testId)
|
|
.WithAlias(testAlias)
|
|
.WithName(testName)
|
|
.WithUserCount(testUserCount)
|
|
.WithIcon(testIcon)
|
|
.WithPermissions(testPermissions)
|
|
.WithStartContentId(testStartContentId)
|
|
.WithStartMediaId(testStartMediaId)
|
|
.Build();
|
|
|
|
// Assert
|
|
Assert.AreEqual(testId, userGroup.Id);
|
|
Assert.AreEqual(testAlias, userGroup.Alias);
|
|
Assert.AreEqual(testName, userGroup.Name);
|
|
Assert.AreEqual(testUserCount, userGroup.UserCount);
|
|
Assert.AreEqual(testIcon, userGroup.Icon);
|
|
Assert.AreEqual(testPermissions.Length, userGroup.Permissions.Count());
|
|
Assert.AreEqual(testStartContentId, userGroup.StartContentId);
|
|
Assert.AreEqual(testStartMediaId, userGroup.StartMediaId);
|
|
}
|
|
}
|
|
}
|