Files
Umbraco-CMS/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/SchemaValidationTest.cs

34 lines
1.3 KiB
C#

using Microsoft.Extensions.Logging;
using NUnit.Framework;
using Umbraco.Cms.Core.Configuration;
using Umbraco.Cms.Core.Events;
using Umbraco.Cms.Infrastructure.Migrations.Install;
using Umbraco.Cms.Tests.Common.Testing;
using Umbraco.Cms.Tests.Integration.Testing;
namespace Umbraco.Cms.Tests.Integration.Umbraco.Infrastructure.Persistence
{
[TestFixture]
[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerFixture)]
public class SchemaValidationTest : UmbracoIntegrationTest
{
private IUmbracoVersion UmbracoVersion => GetRequiredService<IUmbracoVersion>();
private IEventAggregator EventAggregator => GetRequiredService<IEventAggregator>();
[Test]
public void DatabaseSchemaCreation_Produces_DatabaseSchemaResult_With_Zero_Errors()
{
DatabaseSchemaResult result;
using (var scope = ScopeProvider.CreateScope())
{
var schema = new DatabaseSchemaCreator(scope.Database, LoggerFactory.CreateLogger<DatabaseSchemaCreator>(), LoggerFactory, UmbracoVersion, EventAggregator);
result = schema.ValidateSchema(DatabaseSchemaCreator.OrderedTables);
}
// Assert
Assert.That(result.Errors.Count, Is.EqualTo(0));
}
}
}