From 29e122b1f896520053aa835ab2dea84b6fefa806 Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Fri, 29 Oct 2021 13:36:44 +0200 Subject: [PATCH] Add unit testing too --- .../Query/Internal/QuerySqlGeneratorTest.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/test/EFCore.Relational.Tests/Query/Internal/QuerySqlGeneratorTest.cs b/test/EFCore.Relational.Tests/Query/Internal/QuerySqlGeneratorTest.cs index 1e9c078e0d8..8ec337f3a7d 100644 --- a/test/EFCore.Relational.Tests/Query/Internal/QuerySqlGeneratorTest.cs +++ b/test/EFCore.Relational.Tests/Query/Internal/QuerySqlGeneratorTest.cs @@ -21,11 +21,18 @@ public class QuerySqlGeneratorTest [InlineData("")] [InlineData("--SELECT")] public void CheckComposableSql_throws(string sql) - => Assert.Equal( + { + Assert.Equal( RelationalStrings.FromSqlNonComposable, Assert.Throws( () => CreateDummyQuerySqlGenerator().CheckComposableSql(sql)).Message); + Assert.Equal( + RelationalStrings.FromSqlNonComposable, + Assert.Throws( + () => CreateDummyQuerySqlGenerator().CheckComposableSql(sql.Replace("SELECT", "WITH"))).Message); + } + [Theory] [InlineData("SELECT something")] [InlineData(" SELECT something")] @@ -36,7 +43,11 @@ public void CheckComposableSql_throws(string sql) [InlineData(" /* multi\n*line\r\n * comment */ \nSELECT--\n1")] [InlineData("SELECT/* comment */1")] public void CheckComposableSql_does_not_throw(string sql) - => CreateDummyQuerySqlGenerator().CheckComposableSql(sql); + { + CreateDummyQuerySqlGenerator().CheckComposableSql(sql); + + CreateDummyQuerySqlGenerator().CheckComposableSql(sql.Replace("SELECT", "WITH")); + } private DummyQuerySqlGenerator CreateDummyQuerySqlGenerator() => new(