-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ add support for comparing nullable int/long values with enums
- early fail for null value - otherwise just the same :D
- Loading branch information
1 parent
dd2a85c
commit 69adccc
Showing
11 changed files
with
259 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
global using NExpect; | ||
global using NUnit.Framework; | ||
global using static NExpect.AspNetCoreExpectations; | ||
global using static NExpect.Expectations; | ||
global using static NExpect.Expectations; | ||
global using static PeanutButter.RandomGenerators.RandomValueGen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
using System.Net; | ||
using PeanutButter.TestUtils.AspNetCore.Builders; | ||
|
||
namespace NExpect.Matchers.AspNet.Tests | ||
{ | ||
[TestFixture] | ||
public class StatusCodeTests | ||
{ | ||
[Test] | ||
public void LiveIssue_ComparingResponseStatusCodeToEnum() | ||
{ | ||
// Arrange | ||
var statusCode = GetRandom<HttpStatusCode>(); | ||
var res = HttpResponseBuilder.Create() | ||
.WithStatusCode(statusCode) | ||
.Build(); | ||
// Act | ||
Assert.That( | ||
() => | ||
{ | ||
Expect(res.StatusCode) | ||
.To.Equal(statusCode); | ||
}, | ||
Throws.Nothing | ||
); | ||
// Assert | ||
} | ||
|
||
[Test] | ||
public void LiveIssue_NullableLongVsEnum() | ||
{ | ||
// Arrange | ||
var statusCode = GetRandom<HttpStatusCode>(); | ||
var res = HttpResponseBuilder.Create() | ||
.WithStatusCode(statusCode) | ||
.Build(); | ||
long? testMe = res.StatusCode; | ||
// Act | ||
Assert.That(() => | ||
{ | ||
Expect(testMe) | ||
.To.Equal(statusCode); | ||
}, Throws.Nothing); | ||
// Assert | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
global using NExpect; | ||
global using static NExpect.Expectations; | ||
global using static NExpect.Expectations; | ||
global using static PeanutButter.RandomGenerators.RandomValueGen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule PeanutButter
updated
73 files