Skip to content

Commit 0444c78

Browse files
committed
Relaxed some more generic constraints.
1 parent 6792bcd commit 0444c78

File tree

5 files changed

+5
-7
lines changed

5 files changed

+5
-7
lines changed

doc/topics/API/MrKWatkins.Assertions.ObjectAssertions-1.BeTheSameInstanceAs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## Definition
33

44
```c#
5-
public ObjectAssertionsChain<T> BeTheSameInstanceAs(T expected);
5+
public ObjectAssertionsChain<T> BeTheSameInstanceAs(T? expected);
66
```
77

88
## Parameters

doc/topics/API/MrKWatkins.Assertions.ObjectAssertions-1.NotBeTheSameInstanceAs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## Definition
33

44
```c#
5-
public ObjectAssertionsChain<T> NotBeTheSameInstanceAs(T expected);
5+
public ObjectAssertionsChain<T> NotBeTheSameInstanceAs(T? expected);
66
```
77

88
## Parameters

src/MrKWatkins.Assertions.Tests/ObjectAssertionsTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public async Task NotBeNull_Chain()
5353
[Test]
5454
public async Task BeTheSameInstanceAs()
5555
{
56-
TestObject nullValue = null!;
56+
TestObject? nullValue = null;
5757
var value = new TestObject("Test");
5858
var otherValue = new TestObject("Other");
5959

src/MrKWatkins.Assertions/ObjectAssertions.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ namespace MrKWatkins.Assertions;
44

55
[SuppressMessage("ReSharper", "ConditionIsAlwaysTrueOrFalseAccordingToNullableAPIContract")]
66
public class ObjectAssertions<T>
7-
where T : notnull
87
{
98
protected internal ObjectAssertions(T? value)
109
{
@@ -25,14 +24,14 @@ public ObjectAssertionsChain<T> NotBeNull()
2524
return new ObjectAssertionsChain<T>(this);
2625
}
2726

28-
public ObjectAssertionsChain<T> BeTheSameInstanceAs(T expected)
27+
public ObjectAssertionsChain<T> BeTheSameInstanceAs(T? expected)
2928
{
3029
Verify.That(ReferenceEquals(Value, expected), "Value should be the same instance as {0} but was {1}.", expected, Value);
3130

3231
return new ObjectAssertionsChain<T>(this);
3332
}
3433

35-
public ObjectAssertionsChain<T> NotBeTheSameInstanceAs(T expected)
34+
public ObjectAssertionsChain<T> NotBeTheSameInstanceAs(T? expected)
3635
{
3736
Verify.That(!ReferenceEquals(Value, expected), "Value should not be the same instance as {0}.", expected);
3837

src/MrKWatkins.Assertions/ObjectAssertionsChain.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
namespace MrKWatkins.Assertions;
22

33
public readonly struct ObjectAssertionsChain<T>
4-
where T : notnull
54
{
65
internal ObjectAssertionsChain(ObjectAssertions<T> objectAssertions)
76
{

0 commit comments

Comments
 (0)