-
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix single header assertion with no values (#129)
* Fix single header assertion with no values * Bump version
- Loading branch information
Showing
10 changed files
with
143 additions
and
20 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,3 +1,3 @@ | ||
# Guide | ||
|
||
Just here for Algolia | ||
Just here for Algolia |
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,3 +1,3 @@ | ||
# Scenarios | ||
|
||
Just here for Algolia | ||
Just here for Algolia |
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,3 +1,4 @@ | ||
using Alba.Assertions; | ||
using Microsoft.AspNetCore.Http; | ||
using Xunit; | ||
|
||
|
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace Alba.Assertions; | ||
|
||
internal class HeaderExistsAssertion : IScenarioAssertion | ||
{ | ||
private readonly string _headerKey; | ||
|
||
public HeaderExistsAssertion(string headerKey) | ||
{ | ||
_headerKey = headerKey; | ||
} | ||
|
||
public void Assert(Scenario scenario, HttpContext context, ScenarioAssertionException ex) | ||
{ | ||
var values = context.Response.Headers[_headerKey]; | ||
|
||
if (values.Count == 0) | ||
{ | ||
ex.Add($"Expected header '{_headerKey}' to be present but no values were found on the response."); | ||
} | ||
|
||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
src/Alba/NoHeaderValueAssertion.cs → ...Alba/Assertions/NoHeaderValueAssertion.cs
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