-
-
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.
Move to file-scoped namespaces (#166)
- Loading branch information
Showing
47 changed files
with
2,329 additions
and
2,455 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,11 +1,10 @@ | ||
using System; | ||
|
||
namespace Alba | ||
namespace Alba; | ||
|
||
public class AlbaJsonFormatterException : Exception | ||
{ | ||
public class AlbaJsonFormatterException : Exception | ||
public AlbaJsonFormatterException(string json) : base($"The JSON formatter was unable to process the raw JSON:\n{json}") | ||
{ | ||
public AlbaJsonFormatterException(string json) : base($"The JSON formatter was unable to process the raw JSON:\n{json}") | ||
{ | ||
} | ||
} | ||
} |
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,27 +1,26 @@ | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace Alba.Assertions | ||
namespace Alba.Assertions; | ||
|
||
#region sample_BodyContainsAssertion | ||
internal sealed class BodyContainsAssertion : IScenarioAssertion | ||
{ | ||
#region sample_BodyContainsAssertion | ||
internal class BodyContainsAssertion : IScenarioAssertion | ||
{ | ||
public string Text { get; set; } | ||
public string Text { get; set; } | ||
|
||
public BodyContainsAssertion(string text) | ||
{ | ||
Text = text; | ||
} | ||
public BodyContainsAssertion(string text) | ||
{ | ||
Text = text; | ||
} | ||
|
||
public void Assert(Scenario scenario, HttpContext context, ScenarioAssertionException ex) | ||
public void Assert(Scenario scenario, HttpContext context, ScenarioAssertionException ex) | ||
{ | ||
var body = ex.ReadBody(context); | ||
if (!body.Contains(Text)) | ||
{ | ||
var body = ex.ReadBody(context); | ||
if (!body.Contains(Text)) | ||
{ | ||
// Add the failure message to the exception. This exception only | ||
// gets thrown if there are failures. | ||
ex.Add($"Expected text '{Text}' was not found in the response body"); | ||
} | ||
// Add the failure message to the exception. This exception only | ||
// gets thrown if there are failures. | ||
ex.Add($"Expected text '{Text}' was not found in the response body"); | ||
} | ||
} | ||
#endregion | ||
} | ||
#endregion |
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,23 +1,22 @@ | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace Alba.Assertions | ||
namespace Alba.Assertions; | ||
|
||
internal sealed class BodyDoesNotContainAssertion : IScenarioAssertion | ||
{ | ||
internal class BodyDoesNotContainAssertion : IScenarioAssertion | ||
{ | ||
public string Text { get; set; } | ||
public string Text { get; set; } | ||
|
||
public BodyDoesNotContainAssertion(string text) | ||
{ | ||
Text = text; | ||
} | ||
public BodyDoesNotContainAssertion(string text) | ||
{ | ||
Text = text; | ||
} | ||
|
||
public void Assert(Scenario scenario, HttpContext context, ScenarioAssertionException ex) | ||
public void Assert(Scenario scenario, HttpContext context, ScenarioAssertionException ex) | ||
{ | ||
var body = ex.ReadBody(context); | ||
if (body.Contains(Text)) | ||
{ | ||
var body = ex.ReadBody(context); | ||
if (body.Contains(Text)) | ||
{ | ||
ex.Add($"Text '{Text}' should not be found in the response body"); | ||
} | ||
ex.Add($"Text '{Text}' should not be found in the response body"); | ||
} | ||
} | ||
} |
Oops, something went wrong.