Skip to content

Commit

Permalink
More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cincuranet committed Jan 28, 2024
1 parent 06303cf commit 36ffd57
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 82 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

//$Authors = Jiri Cincura ([email protected])

using FirebirdSql.EntityFrameworkCore.Firebird.FunctionalTests.TestModels.Northwind;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Query;
using Microsoft.EntityFrameworkCore.TestModels.Northwind;
Expand All @@ -29,7 +30,7 @@ public NorthwindChangeTrackingQueryFbTest(NorthwindQueryFbFixture<NoopModelCusto
{ }

protected override NorthwindContext CreateNoTrackingContext()
=> new NorthwindRelationalContext(
=> new NorthwindFbContext(
new DbContextOptionsBuilder(Fixture.CreateOptions())
.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking).Options);
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,53 +32,4 @@ public class NorthwindCompiledQueryFbTest : NorthwindCompiledQueryTestBase<North
public NorthwindCompiledQueryFbTest(NorthwindQueryFbFixture<NoopModelCustomizer> fixture)
: base(fixture)
{ }

[Fact]
public override void Query_with_array_parameter()
{
var query = EF.CompileQuery(
(NorthwindContext context, string[] args)
=> context.Customers.Where(c => c.CustomerID == args[0]));

using (var context = CreateContext())
{
Assert.Equal(
CoreStrings.TranslationFailed("DbSet<Customer>() .Where(c => c.CustomerID == __args[0])"),
Assert.Throws<InvalidOperationException>(
() => query(context, new[] { "ALFKI" }).First().CustomerID).Message.Replace("\r", "").Replace("\n", ""));
}

using (var context = CreateContext())
{
Assert.Equal(
CoreStrings.TranslationFailed("DbSet<Customer>() .Where(c => c.CustomerID == __args[0])"),
Assert.Throws<InvalidOperationException>(
() => query(context, new[] { "ANATR" }).First().CustomerID).Message.Replace("\r", "").Replace("\n", ""));
}
}

[Fact]
public override async Task Query_with_array_parameter_async()
{
var query = EF.CompileAsyncQuery(
(NorthwindContext context, string[] args)
=> context.Customers.Where(c => c.CustomerID == args[0]));

using (var context = CreateContext())
{
Assert.Equal(
CoreStrings.TranslationFailed("DbSet<Customer>() .Where(c => c.CustomerID == __args[0])"),
(await Assert.ThrowsAsync<InvalidOperationException>(
() => Enumerate(query(context, new[] { "ALFKI" })))).Message.Replace("\r", "").Replace("\n", ""));
}

using (var context = CreateContext())
{
Assert.Equal(
CoreStrings.TranslationFailed("DbSet<Customer>() .Where(c => c.CustomerID == __args[0])"),
(await Assert.ThrowsAsync<InvalidOperationException>(
() => Enumerate(query(context, new[] { "ANATR" })))).Message.Replace("\r", "").Replace("\n", ""));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -416,22 +416,6 @@ public override Task Where_TimeOnly_subtract_TimeOnly(bool async)
return base.Where_TimeOnly_subtract_TimeOnly(async);
}

[Theory]
[MemberData(nameof(IsAsyncData))]
public override Task ToString_boolean_property_nullable(bool async)
{
return AssertQuery(async, (ISetSource ss) => from lh in ss.Set<LocustHorde>()
select ((object)lh.Eradicated).ToString(), null, elementAsserter: (lhs, rhs) => { Assert.True(lhs.Equals(rhs, System.StringComparison.InvariantCultureIgnoreCase)); }, assertOrder: false, 0, "ToString_boolean_property_nullable");
}

[Theory]
[MemberData(nameof(IsAsyncData))]
public override Task ToString_boolean_property_non_nullable(bool async)
{
return AssertQuery(async, (ISetSource ss) => from w in ss.Set<Weapon>()
select w.IsAutomatic.ToString(), null, elementAsserter: (lhs, rhs) => { Assert.True(lhs.Equals(rhs, System.StringComparison.InvariantCultureIgnoreCase)); }, assertOrder: false, 0, "ToString_boolean_property_non_nullable");
}

[Theory(Skip = "Different implicit ordering on Firebird.")]
[MemberData(nameof(IsAsyncData))]
public override Task Take_without_orderby_followed_by_orderBy_is_pushed_down1(bool async)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -297,22 +297,6 @@ public override Task First_on_byte_array(bool async)
return base.First_on_byte_array(async);
}

[Theory]
[MemberData(nameof(IsAsyncData))]
public override Task ToString_boolean_property_nullable(bool async)
{
return AssertQuery(async, (ISetSource ss) => from lh in ss.Set<LocustHorde>()
select ((object)lh.Eradicated).ToString(), null, elementAsserter: (lhs, rhs) => { Assert.True(lhs.Equals(rhs, System.StringComparison.InvariantCultureIgnoreCase)); }, assertOrder: false, 0, "ToString_boolean_property_nullable");
}

[Theory]
[MemberData(nameof(IsAsyncData))]
public override Task ToString_boolean_property_non_nullable(bool async)
{
return AssertQuery(async, (ISetSource ss) => from w in ss.Set<Weapon>()
select w.IsAutomatic.ToString(), null, elementAsserter: (lhs, rhs) => { Assert.True(lhs.Equals(rhs, System.StringComparison.InvariantCultureIgnoreCase)); }, assertOrder: false, 0, "ToString_boolean_property_non_nullable");
}

[NotSupportedOnFirebirdTheory]
[MemberData(nameof(IsAsyncData))]
public override Task Where_TimeOnly_subtract_TimeOnly(bool async)
Expand Down

0 comments on commit 36ffd57

Please sign in to comment.