Skip to content

Commit 462e14c

Browse files
committed
Fix nullable errors
1 parent 8fdd952 commit 462e14c

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

Tests/Schema.NET.Test/ContextJsonConverterTest.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ public void ReadJson_StringContext_ContextHasName()
1212

1313
var thing = JsonConvert.DeserializeObject<Thing>(json);
1414

15-
Assert.NotNull(thing.Context);
16-
Assert.Equal("foo", thing.Context.Name);
17-
Assert.Null(thing.Context.Language);
15+
Assert.NotNull(thing?.Context);
16+
Assert.Equal("foo", thing?.Context.Name);
17+
Assert.Null(thing?.Context.Language);
1818
}
1919

2020
[Fact]
@@ -24,9 +24,9 @@ public void ReadJson_ObjectContextWithName_ContextHasName()
2424

2525
var thing = JsonConvert.DeserializeObject<Thing>(json);
2626

27-
Assert.NotNull(thing.Context);
28-
Assert.Equal("foo", thing.Context.Name);
29-
Assert.Null(thing.Context.Language);
27+
Assert.NotNull(thing?.Context);
28+
Assert.Equal("foo", thing?.Context.Name);
29+
Assert.Null(thing?.Context.Language);
3030
}
3131

3232
[Fact]
@@ -36,9 +36,9 @@ public void ReadJson_ObjectContextWithNameAndLanguage_ContextHasNameAndLanguage(
3636

3737
var thing = JsonConvert.DeserializeObject<Thing>(json);
3838

39-
Assert.NotNull(thing.Context);
40-
Assert.Equal("foo", thing.Context.Name);
41-
Assert.Equal("en", thing.Context.Language);
39+
Assert.NotNull(thing?.Context);
40+
Assert.Equal("foo", thing?.Context.Name);
41+
Assert.Equal("en", thing?.Context.Language);
4242
}
4343

4444
[Fact]

0 commit comments

Comments
 (0)