diff --git a/tests/MiniProfiler.Tests/SqlFormatterTests.cs b/tests/MiniProfiler.Tests/SqlFormatterTests.cs index 94d06fe4..7064e9e3 100644 --- a/tests/MiniProfiler.Tests/SqlFormatterTests.cs +++ b/tests/MiniProfiler.Tests/SqlFormatterTests.cs @@ -91,7 +91,10 @@ private void AddDbParameter(SqlCommand command, string name, object value, Pa [Fact] public void InlineParameterNamesInParameterValues() { - var formatter = new InlineFormatter(); + var formatter = new InlineFormatter() + { + IncreaseReadability = false + }; var parameters = new List { new SqlTimingParameter() { DbType = "string", Name = "url", Value = "http://www.example.com?myid=1" }, @@ -102,6 +105,40 @@ public void InlineParameterNamesInParameterValues() Assert.Equal("SELECT * FROM urls WHERE url = 'http://www.example.com?myid=1' OR myid = '1'", formatted); } + [Fact] + public void InlineIncreaseReadabilityEnabled() + { + var formatter = new InlineFormatter() + { + IncreaseReadability = true + }; + var parameters = new List + { + new SqlTimingParameter() { DbType = "string", Name = "url", Value = "http://www.example.com?myid=1" }, + new SqlTimingParameter() { DbType = "string", Name = "myid", Value = "1" } + }; + const string command = "SELECT myid,url FROM urls WHERE url = @url OR myid = @myid"; + var formatted = formatter.FormatSql(command, parameters); + Assert.Equal("SELECT myid, url FROM urls WHERE url = 'http://www.example.com?myid=1' OR myid = '1'", formatted); + } + + [Fact] + public void InlineIncreaseReadabilityDisabled() + { + var formatter = new InlineFormatter() + { + IncreaseReadability = false + }; + var parameters = new List + { + new SqlTimingParameter() { DbType = "string", Name = "url", Value = "http://www.example.com?myid=1" }, + new SqlTimingParameter() { DbType = "string", Name = "myid", Value = "1" } + }; + const string command = "SELECT myid,url FROM urls WHERE url = @url OR myid = @myid"; + var formatted = formatter.FormatSql(command, parameters); + Assert.Equal("SELECT myid,url FROM urls WHERE url = 'http://www.example.com?myid=1' OR myid = '1'", formatted); + } + [Fact] public void EnsureVerboseSqlServerFormatterOnlyAddsInformation() {