Skip to content

Commit bc90704

Browse files
authored
Merge pull request #136 from DataObjects-NET/6.0-test-fixes
Revision of tests that fail
2 parents f90d32c + 037a542 commit bc90704

File tree

202 files changed

+9389
-8191
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+9389
-8191
lines changed

ChangeLog/6.0.6_dev.txt

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,25 @@
2121
[main] Obsolete ServerFeatures property is removed
2222
[main] Fixed possible cases of broken serialization due to comparers
2323
[main] Fixed rare cases of insert wrong data into some table columns for SingleTable hierarchies
24-
[sqlserver] Fixed incorrect DateTimeOffset.Date part extraction
25-
[sqlserver] Improved translation of DateTimeOffset.LocalDateTime and DateTimeOffset.TimeOfDay parts extraction
24+
[main] Exception message about unsupported by storage type became more informative
25+
[firebird] Another error code that means unique contraint violation is treated correctly
26+
[firebird] Improved formatting for Float and Double constants within queries
27+
[firebird] Improved work with DateTime query parameters
28+
[firebird] Fixed columns' default value extraction
29+
[mysql] Another error code that means unique contraint violation is treated correctly
30+
[mysql] Fixed DateTime.DayOfWeek translation
31+
[oracle] Changed NULLs ordering settings. Now order is the same as in .NET
32+
[oracle] Improved resolution of TimeSpan literal values on translation
33+
[oracle] Starting from v11 schema names don't have to be in upper-case as storage allowes names in any case
34+
[oracle] Improved translation of Math.Ceiling(), Math.Truncate() and Math.Floor()
35+
[oracle] Fixed byte array fields comparison translation e.g. in Where statements
36+
[oracle] Improved translation of DateTimeOffset's LocalDateTime, ToLocalTime() and ToUniversalTime() members
2637
[postgresql] Improved performance of First(), FirstOrDefault() being subqueries
27-
[postgresql] Improved translation of Math.Ceiling(), Math.Truncate() and Math.Floor()
38+
[postgresql] Improved translation of Math.Ceiling(), Math.Truncate() and Math.Floor() methods
39+
[postgresql] Skip Commit/Rollback operations for already completed transaction to prevent exception overlaping
40+
[sqlite] Fixed some foreign key extraction issues
41+
[sqlite] Improved work with DateTime query parameters
42+
[sqlserver] Fixed incorrect DateTimeOffset.Date part extraction
43+
[sqlserver] Improved translation of DateTimeOffset's LocalDateTime and TimeOfDay members
2844
[reprocessing] ExecuteActionStrategy.Execute doesn't get external session though Session.Current at all
29-
[reprocessing] Introduced DomainExtension.WithSession and IExecuteConfiguration WithSession methods to pass external session
45+
[reprocessing] Introduced DomainExtension.WithSession() and IExecuteConfiguration.WithSession() methods to pass external session
Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,35 @@
11
// Copyright (C) 2019-2020 Xtensive LLC.
22
// This code is distributed under MIT license terms.
33
// See the License.txt file in the project root for more information.
4-
5-
using System.Collections.Generic;
64
using NUnit.Framework;
75
using TestCommon.Model;
8-
using Xtensive.Core;
9-
using Xtensive.Orm;
106
using Xtensive.Orm.Configuration;
7+
using Xtensive.Orm.Tests;
118

129
namespace TestCommon
1310
{
1411
[TestFixture]
15-
public abstract class CommonModelTest
12+
public abstract class CommonModelTest : AutoBuildTest
1613
{
17-
private List<Session> notDisposed;
18-
19-
protected Domain Domain { get; private set; }
14+
private bool justBuilt = true;
2015

2116
[SetUp]
2217
public virtual void SetUp()
2318
{
24-
CheckRequirements();
25-
var config = BuildConfiguration();
26-
Domain = BuildDomain(config);
27-
notDisposed = new List<Session>();
28-
Domain.SessionOpen += (sender, args) => {
29-
notDisposed.Add(args.Session);
30-
args.Session.Events.Disposing += (o, eventArgs) => {
31-
lock (notDisposed) {
32-
notDisposed.Remove(args.Session);
33-
}
34-
};
35-
};
36-
PopulateData();
19+
if (justBuilt) {
20+
justBuilt = false;
21+
}
22+
else {
23+
RebuildDomain();
24+
}
3725
}
3826

39-
[TearDown]
40-
public virtual void TearDown()
41-
{
42-
if (notDisposed!=null)
43-
Assert.That(notDisposed, Is.Empty);
44-
Assert.That(SessionScope.CurrentSession, Is.Null);
45-
Domain.DisposeSafely();
46-
}
4727

48-
protected virtual DomainConfiguration BuildConfiguration()
28+
protected override DomainConfiguration BuildConfiguration()
4929
{
50-
var configuration = DomainConfigurationFactory.Create();
30+
var configuration = base.BuildConfiguration();
5131
configuration.Types.Register(typeof (Bar).Assembly);
5232
return configuration;
5333
}
54-
55-
protected virtual Domain BuildDomain(DomainConfiguration configuration)
56-
{
57-
return Domain.Build(configuration);
58-
}
59-
60-
protected virtual void PopulateData()
61-
{
62-
}
63-
64-
protected virtual void CheckRequirements()
65-
{
66-
}
6734
}
6835
}

Extensions/TestCommon/DomainConfigurationFactory.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

Extensions/TestCommon/HasAccessToConfigurationTest.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

Extensions/TestCommon/TestConfiguration.cs

Lines changed: 0 additions & 100 deletions
This file was deleted.

Extensions/TestCommon/Tests/TestConfigurationTest.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
using System;
1+
using System;
22
using NUnit.Framework;
3+
using Xtensive.Orm.Tests;
34

45
namespace TestCommon.Tests
56
{

Extensions/Xtensive.Orm.BulkOperations.Tests/AutoBuildTest.cs renamed to Extensions/Xtensive.Orm.BulkOperations.Tests/BulkOperationBaseTest.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
using NUnit.Framework;
1+
using NUnit.Framework;
22
using TestCommon;
33
using TestCommon.Model;
44
using Xtensive.Orm.Configuration;
55

66
namespace Xtensive.Orm.BulkOperations.Tests
77
{
88
[TestFixture]
9-
public abstract class AutoBuildTest : CommonModelTest
9+
public abstract class BulkOperationBaseTest : CommonModelTest
1010
{
1111
protected override DomainConfiguration BuildConfiguration()
1212
{
1313
var configuration = base.BuildConfiguration();
14-
configuration.Types.Register(typeof (IUpdatable<>).Assembly);
15-
configuration.Types.Register(typeof (AutoBuildTest).Assembly);
14+
configuration.Types.Register(typeof(IUpdatable<>).Assembly);
15+
configuration.Types.Register(typeof(BulkOperationBaseTest).Assembly);
1616
return configuration;
1717
}
1818
}

Extensions/Xtensive.Orm.BulkOperations.Tests/ContainsTest.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (C) 2020 Xtensive LLC.
1+
// Copyright (C) 2020-2021 Xtensive LLC.
22
// This code is distributed under MIT license terms.
33
// See the License.txt file in the project root for more information.
44

@@ -29,7 +29,7 @@ public TagType(Session session, long id)
2929

3030
namespace Xtensive.Orm.BulkOperations.Tests
3131
{
32-
public class ContainsTest : AutoBuildTest
32+
public class ContainsTest : BulkOperationBaseTest
3333
{
3434
private long[] tagIds;
3535

@@ -45,8 +45,10 @@ protected override void PopulateData()
4545
tagIds = Enumerable.Range(0, 100).Select(i => (long) i).ToArray();
4646
using (var session = Domain.OpenSession())
4747
using (var transaction = session.OpenTransaction()) {
48-
foreach (var id in tagIds.Concat(Enumerable.Repeat(1000, 1).Select(i => (long) i)))
49-
new TagType(session, id) { ProjectedValueAdjustment = -1 };
48+
foreach (var id in tagIds.Concat(Enumerable.Repeat(1000, 1).Select(i => (long) i))) {
49+
_ = new TagType(session, id) { ProjectedValueAdjustment = -1 };
50+
}
51+
5052
transaction.Complete();
5153
}
5254
}
@@ -86,7 +88,7 @@ public void Test3()
8688
{
8789
using (var session = Domain.OpenSession())
8890
using (var tx = session.OpenTransaction()) {
89-
Assert.Throws<NotSupportedException>(() => session.Query.All<TagType>()
91+
_ = Assert.Throws<NotSupportedException>(() => session.Query.All<TagType>()
9092
.Where(t => t.Id.In(IncludeAlgorithm.TemporaryTable, tagIds))
9193
.Set(t => t.ProjectedValueAdjustment, 2)
9294
.Update());

Extensions/Xtensive.Orm.BulkOperations.Tests/Extensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public static class Extensions
88
{
99
public static void AssertCommandCount(this Session session, IResolveConstraint expression, Action action)
1010
{
11-
int count = 0;
11+
var count = 0;
1212
session.Events.DbCommandExecuting += (sender, args) => count++;
1313
action();
1414
Assert.That(count, expression);

Extensions/Xtensive.Orm.BulkOperations.Tests/Issues/IssueJira0560_ChangeFieldWhichDefinedInAncestorClassBug.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@ public abstract class AbstractBaseForServiceMaterial : Entity
4444

4545
namespace Xtensive.Orm.BulkOperations.Tests.Issues
4646
{
47-
public class IssueJira0560_ChangeFieldWhichDefinedInAncestorClassBug : AutoBuildTest
47+
public class IssueJira0560_ChangeFieldWhichDefinedInAncestorClassBug : BulkOperationBaseTest
4848
{
4949
[Test]
5050
public void UpdateTest()
5151
{
52-
List<int> keys = new List<int>();
52+
var keys = new List<int>();
5353
using (var session = Domain.OpenSession())
5454
using (session.Activate())
5555
using (var transaction = session.OpenTransaction()) {
56-
for (int i = 0; i < 10; i++) {
56+
for (var i = 0; i < 10; i++) {
5757
var owner = new PreservedService();
5858
keys.Add(owner.Id);
59-
new ServiceMaterial { Active = false, Owner = owner };
59+
_ = new ServiceMaterial { Active = false, Owner = owner };
6060
}
6161
transaction.Complete();
6262
}

0 commit comments

Comments
 (0)