Skip to content

Commit 4982858

Browse files
committed
Clean up code
1 parent 478424b commit 4982858

35 files changed

Lines changed: 536 additions & 534 deletions

SQL.Formatter.Test/Behavior/BehavesLikeSqlFormatter.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,8 +452,8 @@ public static void FormatsLonelySemicolon(SqlFormatter.Formatter formatter)
452452

453453
public static void DoesNothingWithEmptyInput(SqlFormatter.Formatter formatter)
454454
{
455-
var result = formatter.Format("");
456-
Assert.Equal("", result);
455+
var result = formatter.Format(string.Empty);
456+
Assert.Equal(string.Empty, result);
457457
}
458458
}
459459
}

SQL.Formatter.Test/Db2FormatterTest.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,30 @@ namespace SQL.Formatter.Test
88
{
99
public class Db2FormatterTest
1010
{
11-
public readonly SqlFormatter.Formatter formatter = SqlFormatter.Of(Dialect.Db2);
11+
public readonly SqlFormatter.Formatter Formatter = SqlFormatter.Of(Dialect.Db2);
1212

1313
[Fact]
1414
public void BehavesLikeSqlFormatterTest()
1515
{
16-
BehavesLikeSqlFormatter.Test(formatter);
16+
BehavesLikeSqlFormatter.Test(Formatter);
1717
}
1818

1919
[Fact]
2020
public void CreateTableTest()
2121
{
22-
CreateTable.Test(formatter);
22+
CreateTable.Test(Formatter);
2323
}
2424

2525
[Fact]
2626
public void AlterTableTest()
2727
{
28-
AlterTable.Test(formatter);
28+
AlterTable.Test(Formatter);
2929
}
3030

3131
[Fact]
3232
public void StringsTest()
3333
{
34-
Strings.Test(formatter, new List<string>
34+
Strings.Test(Formatter, new List<string>
3535
{
3636
StringLiteral.DoubleQuote,
3737
StringLiteral.SingleQuote,
@@ -42,13 +42,13 @@ public void StringsTest()
4242
[Fact]
4343
public void BetweenTest()
4444
{
45-
Between.Test(formatter);
45+
Between.Test(Formatter);
4646
}
4747

4848
[Fact]
4949
public void SchemaTest()
5050
{
51-
Schema.Test(formatter);
51+
Schema.Test(Formatter);
5252
}
5353

5454
[Fact]
@@ -63,7 +63,7 @@ public void FormatsFetchFirstLikeLimit()
6363
+ " col2 DESC\n"
6464
+ "FETCH FIRST\n"
6565
+ " 20 ROWS ONLY;",
66-
formatter.Format(
66+
Formatter.Format(
6767
"SELECT col1 FROM tbl ORDER BY col2 DESC FETCH FIRST 20 ROWS ONLY;"));
6868
}
6969
}

SQL.Formatter.Test/MariaDbFormatterTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ namespace SQL.Formatter.Test
66
{
77
public class MariaDbFormatterTest
88
{
9-
public readonly SqlFormatter.Formatter formatter = SqlFormatter.Of(Dialect.MariaDb);
9+
public readonly SqlFormatter.Formatter Formatter = SqlFormatter.Of(Dialect.MariaDb);
1010

1111
[Fact]
1212
public void BehavesLikeMariaDbFormatterTest()
1313
{
14-
BehavesLikeMariaDbFormatter.Test(formatter);
14+
BehavesLikeMariaDbFormatter.Test(Formatter);
1515
}
1616
}
1717
}

SQL.Formatter.Test/MySqlFormatterTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ namespace SQL.Formatter.Test
88
{
99
public class MySqlFormatterTest
1010
{
11-
public readonly SqlFormatter.Formatter formatter = SqlFormatter.Of(Dialect.MySql);
11+
public readonly SqlFormatter.Formatter Formatter = SqlFormatter.Of(Dialect.MySql);
1212

1313
[Fact]
1414
public void BehavesLikeMariaDbFormatterTest()
1515
{
16-
BehavesLikeMariaDbFormatter.Test(formatter);
16+
BehavesLikeMariaDbFormatter.Test(Formatter);
1717
}
1818

1919
[Fact]
2020
public void AdditionalMySqlOperator()
2121
{
22-
Operators.Test(formatter, new List<string>
22+
Operators.Test(Formatter, new List<string>
2323
{
2424
"->",
2525
"->>"

SQL.Formatter.Test/N1qlFormatterTest.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ namespace SQL.Formatter.Test
88
{
99
public class N1qlFormatterTest
1010
{
11-
public readonly SqlFormatter.Formatter formatter = SqlFormatter.Of(Dialect.N1ql);
11+
public readonly SqlFormatter.Formatter Formatter = SqlFormatter.Of(Dialect.N1ql);
1212

1313
[Fact]
1414
public void BehavesLikeSqlFormatterTest()
1515
{
16-
BehavesLikeSqlFormatter.Test(formatter);
16+
BehavesLikeSqlFormatter.Test(Formatter);
1717
}
1818

1919
[Fact]
2020
public void StringsTest()
2121
{
22-
Strings.Test(formatter, new List<string>
22+
Strings.Test(Formatter, new List<string>
2323
{
2424
StringLiteral.DoubleQuote,
2525
StringLiteral.SingleQuote,
@@ -30,19 +30,19 @@ public void StringsTest()
3030
[Fact]
3131
public void BetweenTest()
3232
{
33-
Between.Test(formatter);
33+
Between.Test(Formatter);
3434
}
3535

3636
[Fact]
3737
public void SchemaTest()
3838
{
39-
Schema.Test(formatter);
39+
Schema.Test(Formatter);
4040
}
4141

4242
[Fact]
4343
public void OperatorsTest()
4444
{
45-
Operators.Test(formatter, new List<string>
45+
Operators.Test(Formatter, new List<string>
4646
{
4747
"%",
4848
"==",
@@ -53,7 +53,7 @@ public void OperatorsTest()
5353
[Fact]
5454
public void JoinTest()
5555
{
56-
Join.Test(formatter, new List<string>
56+
Join.Test(Formatter, new List<string>
5757
{
5858
"FULL", "CROSS", "NATURAL"
5959
});
@@ -67,7 +67,7 @@ public void ReplacesDollarNumberedPlaceholdersWithParamValues()
6767
+ " second,\n"
6868
+ " third,\n"
6969
+ " first;",
70-
formatter.Format(
70+
Formatter.Format(
7171
"SELECT $1, $2, $0;",
7272
new Dictionary<string, string>
7373
{
@@ -86,7 +86,7 @@ public void ReplacesDollarVariablesWithParamValues()
8686
+ @" 'var value'," + "\n"
8787
+ @" 'var value'," + "\n"
8888
+ @" 'var value';",
89-
formatter.Format(
89+
Formatter.Format(
9090
@"SELECT $variable, $'var name', $""var name"", $`var name`;",
9191
new Dictionary<string, string>
9292
{
@@ -104,7 +104,7 @@ public void RecognizesDollarVariables()
104104
+ @" $'var name'," + "\n"
105105
+ @" $""var name""," + "\n"
106106
+ @" $`var name`;",
107-
formatter.Format(
107+
Formatter.Format(
108108
@"SELECT $variable, $'var name', $""var name"", $`var name`;"));
109109
}
110110

@@ -118,7 +118,7 @@ public void FormatsUpdateQueryWithUseKeysAndReturning()
118118
+ " 'baldwin'\n"
119119
+ "SET\n"
120120
+ " type = 'actor' RETURNING tutorial.type",
121-
formatter.Format(
121+
Formatter.Format(
122122
"UPDATE tutorial USE KEYS 'baldwin' SET type = 'actor' RETURNING tutorial.type"));
123123
}
124124

@@ -130,7 +130,7 @@ public void FormatsExplainedDeleteQueryWithUseKeysAndReturning()
130130
+ " tutorial t\n"
131131
+ "USE KEYS\n"
132132
+ " 'baldwin' RETURNING t",
133-
formatter.Format(
133+
Formatter.Format(
134134
"EXPLAIN DELETE FROM tutorial t USE KEYS 'baldwin' RETURNING t"));
135135
}
136136

@@ -146,7 +146,7 @@ public void FormatsSelectQueryWithNestAndUseKeys()
146146
+ " 'Elinor_33313792'\n"
147147
+ "NEST\n"
148148
+ " orders_with_users orders ON KEYS ARRAY s.order_id FOR s IN usr.shipped_order_history END;",
149-
formatter.Format(
149+
Formatter.Format(
150150
"SELECT * FROM usr\n"
151151
+ "USE KEYS 'Elinor_33313792' NEST orders_with_users orders\n"
152152
+ "ON KEYS ARRAY s.order_id FOR s IN usr.shipped_order_history END;"));
@@ -162,7 +162,7 @@ public void FormatsSelectQueryWithUnnestTopLevelReservedWord()
162162
+ " tutorial\n"
163163
+ "UNNEST\n"
164164
+ " tutorial.children c;",
165-
formatter.Format(
165+
Formatter.Format(
166166
"SELECT * FROM tutorial UNNEST tutorial.children c;"));
167167
}
168168

@@ -188,7 +188,7 @@ public void FormatsInsertWithLargeObjectAndArrayLiterals()
188188
+ " 'hello': 'world'\n"
189189
+ " }\n"
190190
+ " );",
191-
formatter.Format(
191+
Formatter.Format(
192192
"INSERT INTO heroes (KEY, VALUE) VALUES ('123', {'id': 1, 'type': 'Tarzan',\n"
193193
+ "'array': [123456789, 123456789, 123456789, 123456789, 123456789], 'hello': 'world'});"));
194194
}
@@ -201,7 +201,7 @@ public void FormatsInsertWithCurlyBracketObjectLiteral()
201201
+ " heroes (KEY, VALUE)\n"
202202
+ "VALUES\n"
203203
+ " ('123', {'id': 1, 'type': 'Tarzan'});",
204-
formatter.Format(
204+
Formatter.Format(
205205
"INSERT INTO heroes (KEY, VALUE) VALUES ('123', {'id':1,'type':'Tarzan'});"));
206206
}
207207

@@ -215,7 +215,7 @@ public void FormatsSelectQueryWithPrimaryKeyQuerying()
215215
+ " tutorial\n"
216216
+ "USE KEYS\n"
217217
+ " ['dave', 'ian'];",
218-
formatter.Format(
218+
Formatter.Format(
219219
"SELECT fname, email FROM tutorial USE KEYS ['dave', 'ian'];"));
220220
}
221221

@@ -227,7 +227,7 @@ public void FormatsSelectQueryWithElementSelectionExpression()
227227
+ " order_lines[0].productId\n"
228228
+ "FROM\n"
229229
+ " orders;",
230-
formatter.Format(
230+
Formatter.Format(
231231
"SELECT order_lines[0].productId FROM orders;"));
232232
}
233233
}

0 commit comments

Comments
 (0)