-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6413070
commit 53d29b3
Showing
13 changed files
with
211 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
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,6 +1,8 @@ | ||
<SolutionConfiguration> | ||
<Settings> | ||
<AllowParallelTestExecution>True</AllowParallelTestExecution> | ||
<EnableRDI>False</EnableRDI> | ||
<RdiConfigured>True</RdiConfigured> | ||
<SolutionConfigured>True</SolutionConfigured> | ||
</Settings> | ||
</SolutionConfiguration> |
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
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,60 @@ | ||
using System.Net.Http; | ||
|
||
namespace Codenizer.HttpClient.Testable; | ||
|
||
internal class RequestContentNode : RequestNode | ||
{ | ||
private readonly string? _expectedContent; | ||
|
||
public RequestContentNode(string? expectedContent) | ||
{ | ||
_expectedContent = expectedContent; | ||
} | ||
|
||
public override void Accept(RequestNodeVisitor visitor) | ||
{ | ||
if (_expectedContent != null) | ||
{ | ||
visitor.Content(_expectedContent); | ||
} | ||
|
||
if (RequestBuilder != null) | ||
{ | ||
visitor.Response(RequestBuilder); | ||
} | ||
} | ||
|
||
public RequestBuilder? RequestBuilder { get; private set; } | ||
|
||
public void SetRequestBuilder(RequestBuilder requestBuilder) | ||
{ | ||
if (RequestBuilder != null) | ||
{ | ||
throw new MultipleResponsesConfiguredException(2, requestBuilder.PathAndQuery!); | ||
} | ||
|
||
RequestBuilder = requestBuilder; | ||
} | ||
|
||
public bool Match(HttpContent content) | ||
{ | ||
if (_expectedContent == null) | ||
{ | ||
return true; | ||
} | ||
|
||
if (content is StringContent stringContent) | ||
{ | ||
var requestContent = stringContent.ReadAsStringAsync().GetAwaiter().GetResult(); | ||
|
||
return string.Equals(_expectedContent, requestContent); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public bool Match(string? expectedContent) | ||
{ | ||
return string.Equals(_expectedContent, expectedContent); | ||
} | ||
} |
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