Skip to content

Commit

Permalink
removed cross apply unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
mnsrulz committed Feb 26, 2022
1 parent 9abddb6 commit 2bf0b8a
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions QueryBuilder.Tests/SelectTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -832,22 +832,6 @@ public void BasicSelect_WithNoTable()
var c = Compilers.CompileFor(EngineCodes.SqlServer, q);
Assert.Equal("SELECT [c1]", c.ToString());
}

[Fact]
public void CrossApply_Column_Reusability()
{
var q = new Query("users").Select("name", "salary", "taxbracket", "taxamount", "grosspay")
.CrossApply(new Query().SelectRaw("case when salary < 5000 then 10 when salary < 10000 then 20 else 30 end as taxbracket").As("t1"), j => j)
.CrossApply(new Query().SelectRaw("salary * taxbracket as taxamount").As("t2"), j => j)
.CrossApply(new Query().SelectRaw("salary - taxamount as grosspay").As("t3"), j => j);
var c = Compilers.CompileFor(EngineCodes.SqlServer, q);

Assert.Equal(string.Join("\n", new[] {
"SELECT [name], [salary], [taxbracket], [taxamount], [grosspay] FROM [users] ",
"CROSS APPLY (SELECT case when salary < 5000 then 10 when salary < 10000 then 20 else 30 end as taxbracket) AS [t1]",
"CROSS APPLY (SELECT salary * taxbracket as taxamount) AS [t2]",
"CROSS APPLY (SELECT salary - taxamount as grosspay) AS [t3]",
}), c.ToString());
}

}
}

0 comments on commit 2bf0b8a

Please sign in to comment.