Skip to content

Commit 525d394

Browse files
committed
Constraining T to class
1 parent e5f7d97 commit 525d394

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

src/Docker.DotNet/JsonRequestContent.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
namespace Docker.DotNet;
22

33
internal class JsonRequestContent<T> : IRequestContent
4+
where T : class
45
{
56
private readonly T _value;
67
private readonly JsonSerializer _serializer;
78

89
public JsonRequestContent(T val, JsonSerializer serializer)
910
{
10-
if (EqualityComparer<T>.Default.Equals(val, default))
11+
if (val == null)
1112
{
1213
throw new ArgumentNullException(nameof(val));
1314
}

test/Docker.DotNet.Tests/JsonRequestContentTests.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@ public void Constructor_ThrowsArgumentNullException_WhenValueIsNull()
1010
Assert.Throws<ArgumentNullException>(() => new JsonRequestContent<object>(null, JsonSerializer.Instance));
1111
}
1212

13-
[Fact]
14-
public void Constructor_ThrowsArgumentNullException_WhenValueIsDefault()
15-
{
16-
Assert.Throws<ArgumentNullException>(() => new JsonRequestContent<int>(0, JsonSerializer.Instance));
17-
}
18-
1913
[Fact]
2014
public void Constructor_ThrowsArgumentNullException_WhenSerializerIsNull()
2115
{

0 commit comments

Comments
 (0)