Skip to content

Commit 5f0480b

Browse files
committed
nullable
1 parent 0128f42 commit 5f0480b

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

test/NuGet.Core.Tests/NuGet.Credentials.Test/PluginCredentialResponseDeserializationTests.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
#nullable disable
5-
64
using Newtonsoft.Json;
75
using Xunit;
86

97
namespace NuGet.Credentials.Test
108
{
119
public class PluginCredentialResponseDeserializationTests
1210
{
13-
private static PluginCredentialResponse DeserializeWithStj(string json)
11+
private static PluginCredentialResponse? DeserializeWithStj(string json)
1412
{
1513
return System.Text.Json.JsonSerializer.Deserialize(json, PluginCredentialResponseJsonContext.Default.PluginCredentialResponse);
1614
}
1715

18-
private static PluginCredentialResponse DeserializeWithNsj(string json)
16+
private static PluginCredentialResponse? DeserializeWithNsj(string json)
1917
{
2018
return JsonConvert.DeserializeObject<PluginCredentialResponse>(json);
2119
}
2220

23-
private static void AssertResponsesEqual(PluginCredentialResponse nsj, PluginCredentialResponse stj)
21+
private static void AssertResponsesEqual(PluginCredentialResponse? nsj, PluginCredentialResponse? stj)
2422
{
2523
Assert.Equal(nsj?.Username, stj?.Username);
2624
Assert.Equal(nsj?.Password, stj?.Password);
@@ -49,8 +47,8 @@ private static void AssertResponsesEqual(PluginCredentialResponse nsj, PluginCre
4947
[InlineData(@"{""Username"":""u"",""Password"":""p"",""AuthTypes"":[""basic"",""digest"",""negotiate"",""ntlm""]}")]
5048
public void StjAndNsjProduceSameResult(string json)
5149
{
52-
var nsjResult = DeserializeWithNsj(json);
53-
var stjResult = DeserializeWithStj(json);
50+
PluginCredentialResponse? nsjResult = DeserializeWithNsj(json);
51+
PluginCredentialResponse? stjResult = DeserializeWithStj(json);
5452

5553
AssertResponsesEqual(nsjResult, stjResult);
5654
}
@@ -59,8 +57,8 @@ public void StjAndNsjProduceSameResult(string json)
5957
[InlineData("null")]
6058
public void StjAndNsjBothReturnNull(string json)
6159
{
62-
var nsjResult = DeserializeWithNsj(json);
63-
var stjResult = DeserializeWithStj(json);
60+
PluginCredentialResponse? nsjResult = DeserializeWithNsj(json);
61+
PluginCredentialResponse? stjResult = DeserializeWithStj(json);
6462

6563
Assert.Null(nsjResult);
6664
Assert.Null(stjResult);

0 commit comments

Comments
 (0)