Skip to content

Commit ba6f6d0

Browse files
authored
Replace null checks with is null / is not null (#650)
+semver:patch
1 parent 1d18651 commit ba6f6d0

File tree

192 files changed

+389
-389
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+389
-389
lines changed

src/FluentNHibernate.Specs/Automapping/Fixtures/AutomappingSpecExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ public XmlElementTester(XmlDocument doc, string path)
5151

5252
public XmlElementTester ShouldExist()
5353
{
54-
if (currentElement == null)
54+
if (currentElement is null)
5555
throw new SpecificationException(string.Format("Should exist at {0} but does not.", currentPath));
5656

5757
return this;
5858
}
5959

6060
public XmlElementTester ShouldNotExist()
6161
{
62-
if (currentElement != null)
62+
if (currentElement is not null)
6363
throw new SpecificationException(string.Format("Should not exist at {0} but does.", currentPath));
6464

6565
return this;

src/FluentNHibernate.Testing/AutoMapping/TestFixtures.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public System.Type ReturnedClass
330330
public new bool Equals(object x, object y)
331331
{
332332
if (x == y) return true;
333-
if (x == null || y == null) return false;
333+
if (x is null || y is null) return false;
334334

335335
DoubleString lhs = (DoubleString)x;
336336
DoubleString rhs = (DoubleString)y;
@@ -349,7 +349,7 @@ public int GetHashCode(object x)
349349

350350
public Object DeepCopy(Object x)
351351
{
352-
if (x == null) return null;
352+
if (x is null) return null;
353353
DoubleString result = new DoubleString();
354354
DoubleString input = (DoubleString)x;
355355
result.s1 = input.s1;
@@ -367,7 +367,7 @@ public object NullSafeGet(DbDataReader dr, string[] names, ISessionImplementor s
367367
string first = (string)NHibernateUtil.String.NullSafeGet(dr, names[0], session, owner);
368368
string second = (string)NHibernateUtil.String.NullSafeGet(dr, names[1], session, owner);
369369

370-
return (first == null && second == null) ? null : new string[] { first, second };
370+
return (first is null && second is null) ? null : new string[] { first, second };
371371
}
372372

373373
public void NullSafeSet(DbCommand cmd, object value, int index, bool[] settable, ISessionImplementor session)

src/FluentNHibernate.Testing/Cfg/Db/PersistenceConfigurationTester.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void SetUp()
2020

2121
public string ValueOf(string key)
2222
{
23-
if( _nhibConfig == null )
23+
if( _nhibConfig is null )
2424
{
2525
_nhibConfig = new Configuration();
2626
_config.ConfigureProperties(_nhibConfig);

src/FluentNHibernate.Testing/ConventionsTests/ApplyingToModel/ArrayConventionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ private void VerifyModel(Action<CollectionMapping> modelVerification)
185185

186186
var generatedModels = model.BuildMappings();
187187
var modelInstance = generatedModels
188-
.First(x => x.Classes.FirstOrDefault(c => c.Type == typeof(ExampleParentClass)) != null)
188+
.First(x => x.Classes.FirstOrDefault(c => c.Type == typeof(ExampleParentClass)) is not null)
189189
.Classes.First()
190190
.Collections.First();
191191

src/FluentNHibernate.Testing/ConventionsTests/ApplyingToModel/ClassConventionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ private void VerifyModel(Action<ClassMapping> modelVerification)
148148

149149
var generatedModels = model.BuildMappings();
150150
var modelInstance = generatedModels
151-
.First(x => x.Classes.FirstOrDefault(c => c.Type == typeof(ExampleClass)) != null)
151+
.First(x => x.Classes.FirstOrDefault(c => c.Type == typeof(ExampleClass)) is not null)
152152
.Classes.First();
153153

154154
modelVerification(modelInstance);

src/FluentNHibernate.Testing/ConventionsTests/ApplyingToModel/ComponentConventionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ private void VerifyModel(Action<ComponentMapping> modelVerification)
7777

7878
var generatedModels = model.BuildMappings();
7979
var modelInstance = (ComponentMapping)generatedModels
80-
.First(x => x.Classes.FirstOrDefault(c => c.Type == typeof(PropertyTarget)) != null)
80+
.First(x => x.Classes.FirstOrDefault(c => c.Type == typeof(PropertyTarget)) is not null)
8181
.Classes.First()
8282
.Components.First(x => x is ComponentMapping);
8383

src/FluentNHibernate.Testing/ConventionsTests/ApplyingToModel/CompositeIdConventionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ private void VerifyModel(Action<CompositeIdMapping> modelVerification)
6060

6161
var generatedModels = model.BuildMappings();
6262
var modelInstance = generatedModels
63-
.First(x => x.Classes.FirstOrDefault(c => c.Type == typeof(ExampleClass)) != null)
63+
.First(x => x.Classes.FirstOrDefault(c => c.Type == typeof(ExampleClass)) is not null)
6464
.Classes.First()
6565
.Id;
6666

src/FluentNHibernate.Testing/ConventionsTests/ApplyingToModel/DynamicComponentConventionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ private void VerifyModel(Action<ComponentMapping> modelVerification)
8282

8383
var generatedModels = model.BuildMappings();
8484
var modelInstance = (ComponentMapping)generatedModels
85-
.First(x => x.Classes.FirstOrDefault(c => c.Type == typeof(PropertyTarget)) != null)
85+
.First(x => x.Classes.FirstOrDefault(c => c.Type == typeof(PropertyTarget)) is not null)
8686
.Classes.First()
8787
.Components.First(x => x is ComponentMapping);
8888

src/FluentNHibernate.Testing/ConventionsTests/ApplyingToModel/HasManyCollectionConventionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ private void VerifyModel(Action<CollectionMapping> modelVerification)
257257

258258
var generatedModels = model.BuildMappings();
259259
var modelInstance = generatedModels
260-
.First(x => x.Classes.FirstOrDefault(c => c.Type == typeof(ExampleInheritedClass)) != null)
260+
.First(x => x.Classes.FirstOrDefault(c => c.Type == typeof(ExampleInheritedClass)) is not null)
261261
.Classes.First()
262262
.Collections.First();
263263

src/FluentNHibernate.Testing/ConventionsTests/ApplyingToModel/HasManyConventionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ private void VerifyModel(Action<CollectionMapping> modelVerification)
239239

240240
var generatedModels = model.BuildMappings();
241241
var modelInstance = generatedModels
242-
.First(x => x.Classes.FirstOrDefault(c => c.Type == typeof(ExampleInheritedClass)) != null)
242+
.First(x => x.Classes.FirstOrDefault(c => c.Type == typeof(ExampleInheritedClass)) is not null)
243243
.Classes.First()
244244
.Collections.First();
245245

0 commit comments

Comments
 (0)