Skip to content

Instantly share code, notes, and snippets.

@gordonwatts
Created January 6, 2014 01:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gordonwatts/8276879 to your computer and use it in GitHub Desktop.
Save gordonwatts/8276879 to your computer and use it in GitHub Desktop.
A test that shows how the current re-linq infrastructure doesn't push through and remove all anonymous object references.
[TestMethod]
public void CreateFullEventNoCrossCutAllAnonMin()
{
var q = new QueriableDummyNoExe<LINQToTTreeLib.ResultOperators.ROFirstLastTest.ntup3>();
var result = from d in q
select new
{
matches = from j in d.run1.Select(i => new { pt = i })
select j
};
var r1 = result.SelectMany(m => m.matches).Select(j => j.pt).Sum();
var qm = DummyQueryExectuor.LastQueryModel;
//ReferencedQueryExpressionReplacement.Replace(qm);
Console.WriteLine("Replaced qm: {0}", qm.ToString());
Assert.IsFalse(qm.ContainsClassRef("Anon", "Jet", "TruthJet", "MatchedJet", "matchedEvent"), "still has bogusobject");
}
Test Name: CreateFullEventNoCrossCutAllAnonMin
Test Outcome: Failed
Result Message: Assert.IsFalse failed. still has bogusobject
Result StandardOutput:
Replaced qm: from ntup3 d in value(LINQToTTreeLib.Tests.QueriableDummyNoExe`1[LINQToTTreeLib.ResultOperators.ROFirstLastTest+ntup3]) from <>f__AnonymousTypea0`1 j in {from Int32 i in [d].run1 select new <>f__AnonymousTypea0`1(pt = [i])} select [j].pt => Sum()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment