Migrated user extension tests new project pattern.

This commit is contained in:
Andy Butland
2020-04-11 16:41:28 +02:00
parent b3fd94e023
commit 4456a784b0
3 changed files with 12 additions and 7 deletions

View File

@@ -78,7 +78,10 @@
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Tests.Common</_Parameter1>
</AssemblyAttribute>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Umbraco.Tests.UnitTests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>

View File

@@ -5,14 +5,16 @@ using Moq;
using NUnit.Framework;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Entities;
using Umbraco.Core.Models.Membership;
using Umbraco.Core.Services;
using Umbraco.Tests.Common.Builders;
namespace Umbraco.Tests.Models
namespace Umbraco.Tests.UnitTests.Umbraco.Infrastructure.Models
{
[TestFixture]
public class UserExtensionsTests
{
private readonly UserBuilder _userBuilder = new UserBuilder();
[TestCase(-1, "-1", "-1,1,2,3,4,5", true)] // below root start node
[TestCase(2, "-1,1,2", "-1,1,2,3,4,5", true)] // below start node
[TestCase(5, "-1,1,2,3,4,5", "-1,1,2,3,4,5", true)] // at start node
@@ -24,9 +26,10 @@ namespace Umbraco.Tests.Models
public void Determines_Path_Based_Access_To_Content(int startNodeId, string startNodePath, string contentPath, bool outcome)
{
var userMock = new Mock<IUser>();
userMock.Setup(u => u.StartContentIds).Returns(new[] { startNodeId });
var user = userMock.Object;
var user = _userBuilder
.WithStartContentIds(new[] { startNodeId })
.Build();
var content = Mock.Of<IContent>(c => c.Path == contentPath && c.Id == 5);
var esmock = new Mock<IEntityService>();

View File

@@ -324,7 +324,6 @@
<Compile Include="Clr\ReflectionTests.cs" />
<Compile Include="Macros\MacroParserTests.cs" />
<Compile Include="Models\ContentExtensionsTests.cs" />
<Compile Include="Models\UserExtensionsTests.cs" />
<Compile Include="Web\Mvc\MergeParentContextViewDataAttributeTests.cs" />
<Compile Include="Web\Mvc\ViewDataDictionaryExtensionTests.cs" />
<Compile Include="Persistence\NPocoTests\NPocoBulkInsertTests.cs" />