-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test that BCL Types work with NodaTime plugin activated #1532
Open
davidroth
wants to merge
5
commits into
npgsql:main
Choose a base branch
from
davidroth:1490-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
01874ea
Run BuiltInDataTypesNpgsqlTest again with the NodaTime plugin activat…
davidroth 0732d22
new line
davidroth cc17980
Refactor build in data types test and add BuiltInDataTypesNpgsqlTestB…
davidroth e040800
update to latest npgsql ci-build
davidroth cdea083
cleanup
davidroth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,28 @@ | ||
using System; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.Immutable; | ||
using System.ComponentModel.DataAnnotations.Schema; | ||
using System.Linq; | ||
using System.Net.NetworkInformation; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.EntityFrameworkCore.Infrastructure; | ||
using Microsoft.EntityFrameworkCore.Storage; | ||
using Microsoft.EntityFrameworkCore.TestUtilities; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Microsoft.Extensions.Logging; | ||
using Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal; | ||
using Npgsql.EntityFrameworkCore.PostgreSQL.TestUtilities; | ||
using NpgsqlTypes; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
|
||
namespace Npgsql.EntityFrameworkCore.PostgreSQL | ||
{ | ||
public class BuiltInDataTypesNpgsqlTest : BuiltInDataTypesTestBase<BuiltInDataTypesNpgsqlTest.BuiltInDataTypesNpgsqlFixture> | ||
public abstract class BuiltInDataTypesNpgsqlTestBase<TFixture> : BuiltInDataTypesTestBase<TFixture> | ||
where TFixture : BuiltInDataTypesNpgsqlTestBase<TFixture>.BuiltInDataTypesNpgsqlTestBaseFixture, new() | ||
{ | ||
// ReSharper disable once UnusedParameter.Local | ||
public BuiltInDataTypesNpgsqlTest(BuiltInDataTypesNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) | ||
: base(fixture) | ||
protected BuiltInDataTypesNpgsqlTestBase(TFixture fixture) : base(fixture) | ||
{ | ||
Fixture.TestSqlLoggerFactory.Clear(); | ||
//Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); | ||
} | ||
|
||
[Fact] | ||
|
@@ -119,8 +116,8 @@ public virtual void Can_query_using_any_mapped_data_type() | |
ImmutableDictionaryAsHstore = ImmutableDictionary<string, string>.Empty.Add("c", "d"), | ||
NpgsqlRangeAsRange = new NpgsqlRange<int>(4, true, 8, false), | ||
|
||
IntArrayAsIntArray= new[] { 2, 3 }, | ||
PhysicalAddressArrayAsMacaddrArray= new[] { PhysicalAddress.Parse("08-00-2B-01-02-03"), PhysicalAddress.Parse("08-00-2B-01-02-04") }, | ||
IntArrayAsIntArray = new[] { 2, 3 }, | ||
PhysicalAddressArrayAsMacaddrArray = new[] { PhysicalAddress.Parse("08-00-2B-01-02-03"), PhysicalAddress.Parse("08-00-2B-01-02-04") }, | ||
|
||
UintAsXid = (uint)int.MaxValue + 1, | ||
|
||
|
@@ -423,7 +420,7 @@ public virtual void Can_query_using_any_mapped_data_types_with_nulls() | |
Assert.Same(entity, context.Set<MappedNullableDataTypes>().Single(e => e.Int == 911 && e.IntArrayAsIntArray == param33)); | ||
|
||
PhysicalAddress[] param34 = null; | ||
Assert.Same(entity, context.Set<MappedNullableDataTypes>().Single(e => e.Int == 911 && e.PhysicalAddressArrayAsMacaddrArray== param34)); | ||
Assert.Same(entity, context.Set<MappedNullableDataTypes>().Single(e => e.Int == 911 && e.PhysicalAddressArrayAsMacaddrArray == param34)); | ||
|
||
uint? param35 = null; | ||
Assert.Same(entity, context.Set<MappedNullableDataTypes>().Single(e => e.Int == 911 && e.UintAsXid == param35)); | ||
|
@@ -705,11 +702,11 @@ static void AssertNullMappedNullableDataTypes(MappedNullableDataTypes entity, in | |
Assert.Null(entity.Mood); | ||
} | ||
|
||
[Fact(Skip="https://github.com/aspnet/EntityFrameworkCore/issues/14159")] | ||
public override void Can_query_using_any_data_type_nullable_shadow() {} | ||
[Fact(Skip = "https://github.com/aspnet/EntityFrameworkCore/issues/14159")] | ||
public override void Can_query_using_any_data_type_nullable_shadow() { } | ||
|
||
[Fact(Skip="https://github.com/aspnet/EntityFrameworkCore/issues/14159")] | ||
public override void Can_query_using_any_data_type_shadow() {} | ||
[Fact(Skip = "https://github.com/aspnet/EntityFrameworkCore/issues/14159")] | ||
public override void Can_query_using_any_data_type_shadow() { } | ||
|
||
public override void Can_query_with_null_parameters_using_any_nullable_data_type() | ||
{ | ||
|
@@ -915,7 +912,7 @@ public void Money_compare_parameter() | |
void AssertSql(params string[] expected) | ||
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected); | ||
|
||
public class BuiltInDataTypesNpgsqlFixture : BuiltInDataTypesFixtureBase | ||
public class BuiltInDataTypesNpgsqlTestBaseFixture : BuiltInDataTypesFixtureBase | ||
{ | ||
public override bool StrictEquality => false; | ||
|
||
|
@@ -1361,6 +1358,21 @@ protected class MappedNullableDataTypes | |
} | ||
} | ||
|
||
|
||
public class BuiltInDataTypesNpgsqlTest : BuiltInDataTypesNpgsqlTestBase<BuiltInDataTypesNpgsqlTest.BuiltInDataTypesNpgsqlFixture> | ||
{ | ||
// ReSharper disable once UnusedParameter.Local | ||
public BuiltInDataTypesNpgsqlTest(BuiltInDataTypesNpgsqlFixture fixture, ITestOutputHelper testOutputHelper) | ||
: base(fixture) | ||
{ | ||
Fixture.TestSqlLoggerFactory.Clear(); | ||
//Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Comment copied over from line 28 in main branch. Should I remove it? |
||
} | ||
|
||
public class BuiltInDataTypesNpgsqlFixture : BuiltInDataTypesNpgsqlTestBaseFixture | ||
{ } | ||
} | ||
|
||
// ReSharper disable once UnusedMember.Global | ||
public enum Mood { Happy, Sad }; | ||
} |
35 changes: 35 additions & 0 deletions
35
test/EFCore.PG.NodaTime.FunctionalTests/BuiltInDataTypesWithNodaTimePluginEnabledTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using Microsoft.EntityFrameworkCore; | ||
using Microsoft.Extensions.DependencyInjection; | ||
using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure; | ||
using static Npgsql.EntityFrameworkCore.PostgreSQL.NodaTimeTest; | ||
|
||
namespace Npgsql.EntityFrameworkCore.PostgreSQL | ||
{ | ||
public class BuiltInDataTypesWithNodaTimePluginEnabledTest : BuiltInDataTypesNpgsqlTestBase<BuiltInDataTypesWithNodaTimePluginEnabledTest.BuiltInDataTypesWithNodaTimePluginEnabledFixture> | ||
{ | ||
public BuiltInDataTypesWithNodaTimePluginEnabledTest(BuiltInDataTypesWithNodaTimePluginEnabledFixture fixture) | ||
: base(fixture) => Fixture.TestSqlLoggerFactory.Clear(); | ||
|
||
public class BuiltInDataTypesWithNodaTimePluginEnabledFixture : BuiltInDataTypesNpgsqlTestBaseFixture | ||
{ | ||
protected override string StoreName => "BuiltInDataTypesWithNodaTimeEnabled"; | ||
|
||
protected override IServiceCollection AddServices(IServiceCollection serviceCollection) | ||
=> base.AddServices(serviceCollection).AddEntityFrameworkNpgsqlNodaTime(); | ||
|
||
public override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) | ||
{ | ||
var optionsBuilder = base.AddOptions(builder); | ||
new NpgsqlDbContextOptionsBuilder(optionsBuilder).UseNodaTime(); | ||
|
||
return optionsBuilder; | ||
} | ||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder, DbContext context) | ||
{ | ||
base.OnModelCreating(modelBuilder, context); | ||
modelBuilder.Entity<NodaTimeTypes>(); | ||
} | ||
} | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed to update to pull these changes in.