* 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>
68 lines
1.9 KiB
C#
68 lines
1.9 KiB
C#
// Copyright (c) Umbraco.
|
|
// See LICENSE for more details.
|
|
|
|
using System;
|
|
using NUnit.Framework;
|
|
using Umbraco.Cms.Core.Scoping;
|
|
using Umbraco.Cms.Tests.Common.Testing;
|
|
using Umbraco.Cms.Tests.Integration.Testing;
|
|
using Constants = Umbraco.Cms.Core.Constants;
|
|
|
|
namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence
|
|
{
|
|
[TestFixture]
|
|
[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerTest)]
|
|
public class UnitOfWorkTests : UmbracoIntegrationTest
|
|
{
|
|
[Test]
|
|
public void ReadLockNonExisting()
|
|
{
|
|
IScopeProvider provider = ScopeProvider;
|
|
Assert.Throws<ArgumentException>(() =>
|
|
{
|
|
using (IScope scope = provider.CreateScope())
|
|
{
|
|
scope.EagerReadLock(-666);
|
|
scope.Complete();
|
|
}
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public void ReadLockExisting()
|
|
{
|
|
IScopeProvider provider = ScopeProvider;
|
|
using (IScope scope = provider.CreateScope())
|
|
{
|
|
scope.EagerReadLock(Constants.Locks.Servers);
|
|
scope.Complete();
|
|
}
|
|
}
|
|
|
|
[Test]
|
|
public void WriteLockNonExisting()
|
|
{
|
|
IScopeProvider provider = ScopeProvider;
|
|
Assert.Throws<ArgumentException>(() =>
|
|
{
|
|
using (IScope scope = provider.CreateScope())
|
|
{
|
|
scope.EagerWriteLock(-666);
|
|
scope.Complete();
|
|
}
|
|
});
|
|
}
|
|
|
|
[Test]
|
|
public void WriteLockExisting()
|
|
{
|
|
IScopeProvider provider = ScopeProvider;
|
|
using (IScope scope = provider.CreateScope())
|
|
{
|
|
scope.EagerWriteLock(Constants.Locks.Servers);
|
|
scope.Complete();
|
|
}
|
|
}
|
|
}
|
|
}
|