Removing attributes for migrations as a library that does this already exists.

Updating a few DTOs for programmatic creation.
This commit is contained in:
Morten@Thinkpad-X220.ab-nat1.dk
2012-10-17 10:12:30 -02:00
parent 2523781fc1
commit 5bd2059cd7
28 changed files with 112 additions and 286 deletions

View File

@@ -33,7 +33,7 @@ namespace Umbraco.Tests.Persistence
engine.CreateDatabase();
//Create the umbraco database
DatabaseFactory.Current.Database.Initialize();
//DatabaseFactory.Current.Database.Initialize();
}
[Test]
@@ -59,5 +59,42 @@ namespace Umbraco.Tests.Persistence
//transaction.Complete();
}
}
[Test]
public void Can_Create_umbracoAppTree_Table()
{
var factory = DatabaseFactory.Current;
using (Transaction transaction = factory.Database.GetTransaction())
{
factory.Database.CreateTable<AppTreeDto>();
//transaction.Complete();
}
}
[Test]
public void Can_Create_cmsContentType2ContentType_Table()
{
var factory = DatabaseFactory.Current;
using (Transaction transaction = factory.Database.GetTransaction())
{
factory.Database.CreateTable<ContentType2ContentTypeDto>();
//transaction.Complete();
}
}
[Test, NUnit.Framework.Ignore]
public void Can_Create_cmsContentTypeAllowedContentType_Table()
{
var factory = DatabaseFactory.Current;
using (Transaction transaction = factory.Database.GetTransaction())
{
//Requires the cmsContentType table in order to create refecences
factory.Database.CreateTable<ContentTypeAllowedContentTypeDto>();
//transaction.Complete();
}
}
}
}

View File

@@ -1,28 +0,0 @@
using NUnit.Framework;
using Umbraco.Core.Persistence;
using Umbraco.Tests.TestHelpers.MockedMigrations;
namespace Umbraco.Tests.Persistence
{
[TestFixture]
public class MigrationTests
{
[Test]
public void Can_Verify_Add_ColumnChange()
{
var columnChange = new AddAllowAtRootColumn();
Sql sql = columnChange.ToSql();
Assert.AreEqual(sql.SQL, "ALTER TABLE [cmsContentType] ADD [allowAtRoot] [bit] NOT NULL CONSTRAINT [df_cmsContentType_allowAtRoot] DEFAULT (0);");
}
[Test]
public void Can_Verify_Drop_ColumnChange()
{
var columnChange = new DropMasterContentTypeColumn();
Sql sql = columnChange.ToSql();
Assert.AreEqual(sql.SQL, "ALTER TABLE [cmsContentType] DROP COLUMN [masterContentType];");
}
}
}

View File

@@ -1,49 +0,0 @@
using Umbraco.Core.Persistence.DatabaseAnnotations;
using Umbraco.Core.Persistence.Migrations;
namespace Umbraco.Tests.TestHelpers.MockedMigrations
{
/// <summary>
/// Mocked Column Change that'll generate the following sql:
/// ALTER TABLE [cmsContentType]
/// ADD [allowAtRoot] bit NOT NULL
/// CONSTRAINT [df_cmsContentType_allowAtRoot] DEFAULT 0
/// </summary>
public class AddAllowAtRootColumn : AddColumnChange
{
public override string TableName
{
get { return "cmsContentType"; }
}
public override string Version
{
get { return "4.10.0"; }
}
public override string ColumnName
{
get { return "allowAtRoot"; }
}
public override string Constraint
{
get { return "df_cmsContentType_allowAtRoot"; }
}
public override string DefaultForConstraint
{
get { return "0"; }
}
public override DatabaseTypes DatabaseType
{
get { return DatabaseTypes.Bool; }
}
public override NullSettings NullSetting
{
get { return NullSettings.NotNull; }
}
}
}

View File

@@ -1,26 +0,0 @@
using Umbraco.Core.Persistence.Migrations;
namespace Umbraco.Tests.TestHelpers.MockedMigrations
{
/// <summary>
/// Mocked Column Change that'll generate the following sql:
/// ALTER TABLE [cmsContentType] DROP COLUMN [masterContentType];
/// </summary>
public class DropMasterContentTypeColumn : DropColumnChange
{
public override string Version
{
get { return "4.10.0"; }
}
public override string TableName
{
get { return "cmsContentType"; }
}
public override string ColumnName
{
get { return "masterContentType"; }
}
}
}

View File

@@ -92,7 +92,6 @@
<Compile Include="Models\StylesheetTests.cs" />
<Compile Include="Persistence\DatabaseExtensionsTest.cs" />
<Compile Include="Persistence\DatabaseFactoryTests.cs" />
<Compile Include="Persistence\MigrationTests.cs" />
<Compile Include="Persistence\RepositoryResolverTests.cs" />
<Compile Include="Resolvers\ActionsResolverTests.cs" />
<Compile Include="AsynchronousRollingFileAppenderTests.cs" />
@@ -129,8 +128,6 @@
<Compile Include="TestHelpers\Entities\MockedContent.cs" />
<Compile Include="TestHelpers\Entities\MockedContentTypes.cs" />
<Compile Include="TestHelpers\Entities\MockedEntity.cs" />
<Compile Include="TestHelpers\MockedMigrations\AddAllowAtRootColumn.cs" />
<Compile Include="TestHelpers\MockedMigrations\DropMasterContentTypeColumn.cs" />
<Compile Include="UriUtilityTests.cs" />
<Compile Include="Resolvers\MacroFieldEditorsResolverTests.cs" />
<Compile Include="MacroEngineFactoryTests.cs" />