Skip to content

Commit

Permalink
test for #3847
Browse files Browse the repository at this point in the history
  • Loading branch information
jogibear9988 committed Jan 25, 2024
1 parent 194b4e8 commit 46bfc10
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions Tests/Linq/UserTests/Issue3847Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using LinqToDB;
using LinqToDB.Data;
using LinqToDB.Mapping;
using Newtonsoft.Json;
using NUnit.Framework;

namespace Tests.UserTests.Test3847
{
public class OutfeedTransportOrderDTO
{
public virtual Guid Id { get; set; }
}

[TestFixture]
public class Issue3847Tests : TestBase
{
[Test]
public void Test3847([IncludeDataSources(TestProvName.AllSQLite, TestProvName.AllSqlServer, TestProvName.AllPostgreSQL)] string configuration)
{
using (var db = GetDataContext(
configuration,
new FluentMappingBuilder()
.Entity<OutfeedTransportOrderDTO>()
.HasTableName("Test3847_OutfeedTransportOrder")
.Build()
.MappingSchema))
{
using (db.CreateLocalTable<OutfeedTransportOrderDTO>())
{
var _lastCheck = new Dictionary<Guid, DateTime>();
var _nextCheck = new Dictionary<Guid, DateTime>();
IQueryable<KeyValuePair<Guid, DateTime>> lastcheckquery = _lastCheck.AsQueryable();
IQueryable<KeyValuePair<Guid, DateTime>> nextcheckquery = _nextCheck.AsQueryable();

var qry = from outfeed in db.GetTable<OutfeedTransportOrderDTO>()
select new
{
OutfeedTransportOrder = outfeed,
LastCheck = lastcheckquery.Where(x => x.Key == outfeed.Id).Select(x => (DateTime?)x.Value).FirstOrDefault(),
NextCheck = nextcheckquery.Where(x => x.Key == outfeed.Id).Select(x => (DateTime?)x.Value).FirstOrDefault(),

};

var d = qry.ToList();
var sql = ((DataConnection)db).LastQuery;
}
}
}
}
}

0 comments on commit 46bfc10

Please sign in to comment.