Files
Umbraco-CMS/src/Umbraco.Tests.Integration/Umbraco.Infrastructure/Persistence/SchemaValidationTest.cs
2021-02-10 14:45:44 +01:00

33 lines
1.1 KiB
C#

using Microsoft.Extensions.Logging;
using NUnit.Framework;
using Umbraco.Cms.Core.Configuration;
using Umbraco.Cms.Tests.Common.Testing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Migrations.Install;
using Umbraco.Tests.Integration.Testing;
namespace Umbraco.Tests.Persistence
{
[TestFixture]
[UmbracoTest(Database = UmbracoTestOptions.Database.NewSchemaPerFixture)]
public class SchemaValidationTest : UmbracoIntegrationTest
{
private IUmbracoVersion UmbracoVersion => GetRequiredService<IUmbracoVersion>();
[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);
result = schema.ValidateSchema(DatabaseSchemaCreator.OrderedTables);
}
// Assert
Assert.That(result.Errors.Count, Is.EqualTo(0));
}
}
}