Skip to content

Commit 50e0156

Browse files
committed
Fixed tests for Mysql
1 parent 89a17cd commit 50e0156

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

Orm/Xtensive.Orm.Tests/Storage/IgnoreRulesValidateTest.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public class Book : Entity
6464
[Field, Key]
6565
public long Id { get; private set; }
6666

67-
[Field]
67+
[Field(Length = 50)]
6868
public string Title { get; set; }
6969

7070
[Field(Length = 13)]
@@ -195,7 +195,7 @@ public class Book : Entity
195195
[Field, Key]
196196
public long Id { get; private set; }
197197

198-
[Field]
198+
[Field(Length = 50)]
199199
public string Title { get; set; }
200200

201201
[Field(Length = 13)]
@@ -343,7 +343,7 @@ public class IgnoreRulesValidateTest
343343
typeof(ignorablePart.IgnoredTable), typeof(ignorablePart.FieldInjector) };
344344

345345
private readonly bool createConstraintsWithTable = StorageProviderInfo.Instance.Provider == StorageProvider.Sqlite;
346-
private readonly bool dropIndexOnKeyColumnDelete = StorageProviderInfo.Instance.Provider== StorageProvider.PostgreSql;
346+
private readonly bool noExceptionOnIndexKeyColumnDrop = StorageProviderInfo.Instance.Provider.In(StorageProvider.PostgreSql, StorageProvider.MySql);
347347
private readonly SqlDriver sqlDriver = TestSqlDriver.Create(GetConnectionInfo());
348348

349349
private Key changedOrderKey;
@@ -411,7 +411,8 @@ public void IgnoreColumnTest()
411411
Assert.That(table.Columns.Any(c => c.Name == "SimpleIgnoredColumn"), Is.True);
412412
Assert.That(table.Columns.Count(c => c.Name.StartsWith("IgnoreA")), Is.EqualTo(3));
413413
Assert.That(
414-
schema.Tables.Where(t => t.Name.StartsWith("MyEntity")).SelectMany(t => t.Columns).Count(c => c.Name.StartsWith("IgnoreB")),
414+
schema.Tables.Where(t => t.Name.StartsWith("MyEntity", StringComparison.OrdinalIgnoreCase))
415+
.SelectMany(t => t.Columns).Count(c => c.Name.StartsWith("IgnoreB")),
415416
Is.EqualTo(6));
416417

417418
if (StorageProviderInfo.Instance.CheckAllFeaturesSupported(ProviderFeatures.ForeignKeyConstraints)) {
@@ -471,7 +472,9 @@ public void IgnoreIndexTest()
471472
BuildDomain(DomainUpgradeMode.Perform, ingnoreRuleCollection, model1Types).Dispose();
472473

473474
Assert.That(GetCatalog().DefaultSchema.Tables["Book"].Indexes.Any(i => i.Name == "IX_Ignored_Index"), Is.True);
474-
Assert.That(GetCatalog().DefaultSchema.Tables["Book"].Indexes.Count(i => i.Name.StartsWith("IX_GIgnored_Index")), Is.EqualTo(2));
475+
Assert.That(GetCatalog().DefaultSchema.Tables["Book"].Indexes
476+
.Count(i => i.Name.StartsWith("IX_GIgnored_Index", StringComparison.OrdinalIgnoreCase)),
477+
Is.EqualTo(2));
475478
}
476479

477480
[Test]
@@ -659,7 +662,7 @@ public void DropKeyColumnOfIgnoredIndexTest()
659662

660663
var ignoreRuleCollection = new IgnoreRuleCollection();
661664
_ = ignoreRuleCollection.IgnoreIndex("IX_Ignored_Index").WhenTable("MyEntity2");
662-
if (dropIndexOnKeyColumnDelete) {
665+
if (noExceptionOnIndexKeyColumnDrop) {
663666
BuildDomain(DomainUpgradeMode.Perform, ignoreRuleCollection, model6Types).Dispose();
664667
}
665668
else {

0 commit comments

Comments
 (0)