Skip to content

Commit f929aed

Browse files
author
Tomas Lukac
committed
remove unnecessary code formatting
1 parent abd5f6c commit f929aed

File tree

3 files changed

+51
-50
lines changed

3 files changed

+51
-50
lines changed

src/NHibernate.Test/Linq/CustomExtensionsExample.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Linq.Expressions;
55
using System.Reflection;
66
using System.Text.RegularExpressions;
7+
using NHibernate.DomainModel.Northwind.Entities;
78
using NHibernate.Hql.Ast;
89
using NHibernate.Linq.Functions;
910
using NHibernate.Linq.Visitors;
@@ -18,7 +19,7 @@ public static bool IsLike(this string source, string pattern)
1819
{
1920
pattern = Regex.Escape(pattern);
2021
pattern = pattern.Replace("%", ".*?").Replace("_", ".");
21-
pattern = pattern.Replace(@"\[", "[").Replace(@"\]", "]").Replace(@"\^", "^");
22+
pattern = pattern.Replace(@"\[", "[").Replace(@"\]","]").Replace(@"\^", "^");
2223

2324
return Regex.IsMatch(source, pattern);
2425
}

src/NHibernate.Test/Linq/FunctionTests.cs

+46-46
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ public void LikeFunctionWithEscapeCharacter()
3636
session.Flush();
3737

3838
var query = (from e in db.Employees
39-
where NHibernate.Linq.SqlMethods.Like(e.FirstName, employeeNameEscaped, escapeChar)
40-
select e).ToList();
39+
where NHibernate.Linq.SqlMethods.Like(e.FirstName, employeeNameEscaped, escapeChar)
40+
select e).ToList();
4141

4242
Assert.That(query.Count, Is.EqualTo(1));
4343
Assert.That(query[0].FirstName, Is.EqualTo(employeeName));
@@ -81,8 +81,8 @@ where NHibernate.Test.Linq.FunctionTests.SqlMethods.Like(e.FirstName, "Ma%et")
8181
public void SubstringFunction2()
8282
{
8383
var query = (from e in db.Employees
84-
where e.FirstName.Substring(0, 2) == "An"
85-
select e).ToList();
84+
where e.FirstName.Substring(0, 2) == "An"
85+
select e).ToList();
8686

8787
Assert.That(query.Count, Is.EqualTo(2));
8888
}
@@ -91,8 +91,8 @@ where e.FirstName.Substring(0, 2) == "An"
9191
public void SubstringFunction1()
9292
{
9393
var query = (from e in db.Employees
94-
where e.FirstName.Substring(3) == "rew"
95-
select e).ToList();
94+
where e.FirstName.Substring(3) == "rew"
95+
select e).ToList();
9696

9797
Assert.That(query.Count, Is.EqualTo(1));
9898
Assert.That(query[0].FirstName, Is.EqualTo("Andrew"));
@@ -130,21 +130,21 @@ public void ReplaceFunction()
130130
var query = from e in db.Employees
131131
where e.FirstName.StartsWith("An")
132132
select new
133-
{
134-
Before = e.FirstName,
135-
// This one call the standard string.Replace, not the extension. The linq registry handles it.
136-
AfterMethod = e.FirstName.Replace("An", "Zan"),
137-
AfterExtension = ExtensionMethods.Replace(e.FirstName, "An", "Zan"),
138-
AfterNamedExtension = e.FirstName.ReplaceExtension("An", "Zan"),
139-
AfterEvaluableExtension = e.FirstName.ReplaceWithEvaluation("An", "Zan"),
140-
AfterEvaluable2Extension = e.FirstName.ReplaceWithEvaluation2("An", "Zan"),
133+
{
134+
Before = e.FirstName,
135+
// This one call the standard string.Replace, not the extension. The linq registry handles it.
136+
AfterMethod = e.FirstName.Replace("An", "Zan"),
137+
AfterExtension = ExtensionMethods.Replace(e.FirstName, "An", "Zan"),
138+
AfterNamedExtension = e.FirstName.ReplaceExtension("An", "Zan"),
139+
AfterEvaluableExtension = e.FirstName.ReplaceWithEvaluation("An", "Zan"),
140+
AfterEvaluable2Extension = e.FirstName.ReplaceWithEvaluation2("An", "Zan"),
141141
BeforeConst = suppliedName,
142-
// This one call the standard string.Replace, not the extension. The linq registry handles it.
143-
AfterMethodConst = suppliedName.Replace("An", "Zan"),
144-
AfterExtensionConst = ExtensionMethods.Replace(suppliedName, "An", "Zan"),
145-
AfterNamedExtensionConst = suppliedName.ReplaceExtension("An", "Zan"),
146-
AfterEvaluableExtensionConst = suppliedName.ReplaceWithEvaluation("An", "Zan"),
147-
AfterEvaluable2ExtensionConst = suppliedName.ReplaceWithEvaluation2("An", "Zan")
142+
// This one call the standard string.Replace, not the extension. The linq registry handles it.
143+
AfterMethodConst = suppliedName.Replace("An", "Zan"),
144+
AfterExtensionConst = ExtensionMethods.Replace(suppliedName, "An", "Zan"),
145+
AfterNamedExtensionConst = suppliedName.ReplaceExtension("An", "Zan"),
146+
AfterEvaluableExtensionConst = suppliedName.ReplaceWithEvaluation("An", "Zan"),
147+
AfterEvaluable2ExtensionConst = suppliedName.ReplaceWithEvaluation2("An", "Zan")
148148
};
149149
var results = query.ToList();
150150
var s = ObjectDumper.Write(results);
@@ -171,12 +171,12 @@ where e.FirstName.StartsWith("An")
171171
// Should cause ReplaceWithEvaluation to fail
172172
suppliedName = null;
173173
var failingQuery = from e in db.Employees
174-
where e.FirstName.StartsWith("An")
175-
select new
176-
{
177-
Before = e.FirstName,
178-
AfterEvaluableExtensionConst = suppliedName.ReplaceWithEvaluation("An", "Zan")
179-
};
174+
where e.FirstName.StartsWith("An")
175+
select new
176+
{
177+
Before = e.FirstName,
178+
AfterEvaluableExtensionConst = suppliedName.ReplaceWithEvaluation("An", "Zan")
179+
};
180180
Assert.That(() => failingQuery.ToList(), Throws.InstanceOf<HibernateException>().And.InnerException.InstanceOf<ArgumentNullException>());
181181
}
182182

@@ -248,7 +248,7 @@ where lowerName.Contains("a")
248248
public void TwoFunctionExpression()
249249
{
250250
var query = from e in db.Employees
251-
where e.FirstName.IndexOf("A") == e.BirthDate.Value.Month
251+
where e.FirstName.IndexOf("A") == e.BirthDate.Value.Month
252252
select e.FirstName;
253253

254254
ObjectDumper.Write(query);
@@ -285,9 +285,9 @@ public void Trim()
285285
{
286286
using (session.BeginTransaction())
287287
{
288-
AnotherEntity ae1 = new AnotherEntity { Input = " hi " };
289-
AnotherEntity ae2 = new AnotherEntity { Input = "hi" };
290-
AnotherEntity ae3 = new AnotherEntity { Input = "heh" };
288+
AnotherEntity ae1 = new AnotherEntity {Input = " hi "};
289+
AnotherEntity ae2 = new AnotherEntity {Input = "hi"};
290+
AnotherEntity ae3 = new AnotherEntity {Input = "heh"};
291291
session.Save(ae1);
292292
session.Save(ae2);
293293
session.Save(ae3);
@@ -303,7 +303,7 @@ public void Trim()
303303

304304
// Check when passed as array
305305
// (the single character parameter is a new overload in .netcoreapp2.0, but not net461 or .netstandard2.0).
306-
Assert.AreEqual(1, session.Query<AnotherEntity>().Count(e => e.Input.Trim(new[] { 'h' }) == "e"));
306+
Assert.AreEqual(1, session.Query<AnotherEntity>().Count(e => e.Input.Trim(new [] { 'h' }) == "e"));
307307
Assert.AreEqual(1, session.Query<AnotherEntity>().Count(e => e.Input.TrimStart(new[] { 'h' }) == "eh"));
308308
Assert.AreEqual(1, session.Query<AnotherEntity>().Count(e => e.Input.TrimEnd(new[] { 'h' }) == "he"));
309309

@@ -316,9 +316,9 @@ public void TrimInitialWhitespace()
316316
{
317317
using (session.BeginTransaction())
318318
{
319-
session.Save(new AnotherEntity { Input = " hi" });
320-
session.Save(new AnotherEntity { Input = "hi" });
321-
session.Save(new AnotherEntity { Input = "heh" });
319+
session.Save(new AnotherEntity {Input = " hi"});
320+
session.Save(new AnotherEntity {Input = "hi"});
321+
session.Save(new AnotherEntity {Input = "heh"});
322322
session.Flush();
323323

324324
Assert.That(session.Query<AnotherEntity>().Count(e => e.Input.TrimStart() == "hi"), Is.EqualTo(2));
@@ -372,7 +372,7 @@ public void WhereBoolConstantEqual()
372372
var query = from item in db.Role
373373
where item.IsActive.Equals(true)
374374
select item;
375-
375+
376376
ObjectDumper.Write(query);
377377
}
378378

@@ -382,7 +382,7 @@ public void WhereBoolConditionEquals()
382382
var query = from item in db.Role
383383
where item.IsActive.Equals(item.Name != null)
384384
select item;
385-
385+
386386
ObjectDumper.Write(query);
387387
}
388388

@@ -392,7 +392,7 @@ public void WhereBoolParameterEqual()
392392
var query = from item in db.Role
393393
where item.IsActive.Equals(1 == 1)
394394
select item;
395-
395+
396396
ObjectDumper.Write(query);
397397
}
398398

@@ -412,8 +412,8 @@ where item.IsActive.Equals(f())
412412
public void WhereLongEqual()
413413
{
414414
var query = from item in db.PatientRecords
415-
where item.Id.Equals(-1)
416-
select item;
415+
where item.Id.Equals(-1)
416+
select item;
417417

418418
ObjectDumper.Write(query);
419419
}
@@ -427,7 +427,7 @@ where item.RegisteredAt.Equals(DateTime.Today)
427427

428428
ObjectDumper.Write(query);
429429
}
430-
430+
431431
[Test]
432432
public void WhereGuidEqual()
433433
{
@@ -436,7 +436,7 @@ where item.Reference.Equals(Guid.Empty)
436436
select item;
437437

438438
ObjectDumper.Write(query);
439-
}
439+
}
440440

441441
[Test]
442442
public void WhereDoubleEqual()
@@ -446,8 +446,8 @@ where item.BodyWeight.Equals(-1)
446446
select item;
447447

448448
ObjectDumper.Write(query);
449-
}
450-
449+
}
450+
451451
[Test]
452452
[Ignore("Not mapped entity")]
453453
public void WhereFloatEqual()
@@ -457,7 +457,7 @@ where item.Float.Equals(-1)
457457
select item;
458458

459459
ObjectDumper.Write(query);
460-
}
460+
}
461461

462462
[Test]
463463
[Ignore("Not mapped entity")]
@@ -522,8 +522,8 @@ public void WhereObjectEqual()
522522
public void WhereEquatableEqual()
523523
{
524524
var query = from item in db.Shippers
525-
where ((IEquatable<Guid>) item.Reference).Equals(Guid.Empty)
526-
select item;
525+
where ((IEquatable<Guid>) item.Reference).Equals(Guid.Empty)
526+
select item;
527527

528528
ObjectDumper.Write(query);
529529
}

src/NHibernate.Test/NHSpecificTest/GH1879/ExpansionRegressionTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void MethodShouldNotExpandForNonConditionalOrCoalesce()
2626
{
2727
using (var session = OpenSession())
2828
{
29-
Assert.That(session.Query<Invoice>().Count(e => ((object) (e.Amount + e.SpecialAmount)).Equals(110)), Is.EqualTo(2));
29+
Assert.That(session.Query<Invoice>().Count(e => ((object)(e.Amount + e.SpecialAmount)).Equals(110)), Is.EqualTo(2));
3030
}
3131
}
3232

@@ -35,7 +35,7 @@ public void MethodShouldNotExpandForConditionalWithPropertyAccessor()
3535
{
3636
using (var session = OpenSession())
3737
{
38-
Assert.That(session.Query<Invoice>().Count(e => ((object) (e.Paid ? e.Amount : e.SpecialAmount)).Equals(10)), Is.EqualTo(2));
38+
Assert.That(session.Query<Invoice>().Count(e => ((object)(e.Paid ? e.Amount : e.SpecialAmount)).Equals(10)), Is.EqualTo(2));
3939
}
4040
}
4141

@@ -44,7 +44,7 @@ public void MethodShouldNotExpandForCoalesceWithPropertyAccessor()
4444
{
4545
using (var session = OpenSession())
4646
{
47-
Assert.That(session.Query<Invoice>().Count(e => ((object) (e.SpecialAmount ?? e.Amount)).Equals(100)), Is.EqualTo(2));
47+
Assert.That(session.Query<Invoice>().Count(e => ((object)(e.SpecialAmount ?? e.Amount)).Equals(100)), Is.EqualTo(2));
4848
}
4949
}
5050
}

0 commit comments

Comments
 (0)