Skip to content

Commit e40d34e

Browse files
JaBistDuNarrischJaBistDuNarrisch
authored andcommitted
Moved AddTable test
1 parent 4547883 commit e40d34e

File tree

4 files changed

+83
-10
lines changed

4 files changed

+83
-10
lines changed

src/Migrator.Tests/Providers/Generic/TransformationProviderGenericMiscConstraintBase.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,17 +127,7 @@ public void ConstraintExist()
127127
Assert.That(Provider.ConstraintExists("abc", "abc"), Is.False);
128128
}
129129

130-
[Test]
131-
public void AddTableWithCompoundPrimaryKey()
132-
{
133-
Provider.AddTable("Test",
134-
new Column("PersonId", DbType.Int32, ColumnProperty.PrimaryKey),
135-
new Column("AddressId", DbType.Int32, ColumnProperty.PrimaryKey)
136-
);
137130

138-
Assert.That(Provider.TableExists("Test"), Is.True, "Table doesn't exist");
139-
Assert.That(Provider.PrimaryKeyExists("Test", "PK_Test"), Is.True, "Constraint doesn't exist");
140-
}
141131

142132
[Test]
143133
public void AddTableWithCompoundPrimaryKeyShouldKeepNullForOtherProperties()
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Data;
2+
using System.Threading.Tasks;
3+
using DotNetProjects.Migrator.Framework;
4+
using Migrator.Tests.Providers.Base;
5+
using NUnit.Framework;
6+
7+
namespace Migrator.Tests.Providers.OracleProvider;
8+
9+
[TestFixture]
10+
[Category("Oracle")]
11+
public class OracleTransformationProvider_AddTable_Tests : TransformationProviderBase
12+
{
13+
[SetUp]
14+
public async Task SetUpAsync()
15+
{
16+
await BeginOracleTransactionAsync();
17+
}
18+
19+
[Test]
20+
public void AddTableWithCompoundPrimaryKey()
21+
{
22+
Provider.AddTable("Test",
23+
new Column("PersonId", DbType.Int32, ColumnProperty.PrimaryKey),
24+
new Column("AddressId", DbType.Int32, ColumnProperty.PrimaryKey)
25+
);
26+
27+
Assert.That(Provider.TableExists("Test"), Is.True, "Table doesn't exist");
28+
Assert.That(Provider.PrimaryKeyExists("Test", "PK_Test"), Is.True, "Constraint doesn't exist");
29+
}
30+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Data;
3+
using DotNetProjects.Migrator.Framework;
4+
using NUnit.Framework;
5+
6+
namespace Migrator.Tests.Providers.PostgreSQL;
7+
8+
[TestFixture]
9+
[Category("Postgre")]
10+
public class PostgreSQLTransformationProvider_AddTableTests : PostgreSQLTransformationProviderTestBase
11+
{
12+
[Test]
13+
public void AddTableWithCompoundPrimaryKey()
14+
{
15+
Provider.AddTable("Test",
16+
new Column("PersonId", DbType.Int32, ColumnProperty.PrimaryKey),
17+
new Column("AddressId", DbType.Int32, ColumnProperty.PrimaryKey)
18+
);
19+
20+
Assert.That(Provider.TableExists("Test"), Is.True, "Table doesn't exist");
21+
Assert.That(Provider.PrimaryKeyExists("Test", "PK_Test"), Is.True, "Constraint doesn't exist");
22+
}
23+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System.Data;
2+
using System.Threading.Tasks;
3+
using DotNetProjects.Migrator.Framework;
4+
using Migrator.Tests.Providers.Base;
5+
using NUnit.Framework;
6+
7+
namespace Migrator.Tests.Providers.SQLServer;
8+
9+
[TestFixture]
10+
[Category("SqlServer")]
11+
public class SQLServerTransformationProvider_AddTableTests : TransformationProviderBase
12+
{
13+
[SetUp]
14+
public async Task SetUpAsync()
15+
{
16+
await BeginSQLServerTransactionAsync();
17+
}
18+
19+
[Test]
20+
public void AddTableWithCompoundPrimaryKey()
21+
{
22+
Provider.AddTable("Test",
23+
new Column("PersonId", DbType.Int32, ColumnProperty.PrimaryKey),
24+
new Column("AddressId", DbType.Int32, ColumnProperty.PrimaryKey)
25+
);
26+
27+
Assert.That(Provider.TableExists("Test"), Is.True, "Table doesn't exist");
28+
Assert.That(Provider.PrimaryKeyExists("Test", "PK_Test"), Is.True, "Constraint doesn't exist");
29+
}
30+
}

0 commit comments

Comments
 (0)