summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/Mocks
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2008-11-08 19:11:56 -0800
committerAndrew <andrewarnott@gmail.com>2008-11-08 19:11:56 -0800
commit9ebbf7e45657fca07ec70374bab820f21c964e47 (patch)
treead5a342117750d7ec537b68cda1d0e4e78613c10 /src/DotNetOpenAuth.Test/Mocks
parente16b0c1bfd1825485cb2c8461655e884f0ecac5a (diff)
downloadDotNetOpenAuth-9ebbf7e45657fca07ec70374bab820f21c964e47.zip
DotNetOpenAuth-9ebbf7e45657fca07ec70374bab820f21c964e47.tar.gz
DotNetOpenAuth-9ebbf7e45657fca07ec70374bab820f21c964e47.tar.bz2
Added tests for OpenIdChannel and KeyValueForm encoder.
Diffstat (limited to 'src/DotNetOpenAuth.Test/Mocks')
-rw-r--r--src/DotNetOpenAuth.Test/Mocks/TestWebRequestHandler.cs30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/DotNetOpenAuth.Test/Mocks/TestWebRequestHandler.cs b/src/DotNetOpenAuth.Test/Mocks/TestWebRequestHandler.cs
index d7092b4..7117bc1 100644
--- a/src/DotNetOpenAuth.Test/Mocks/TestWebRequestHandler.cs
+++ b/src/DotNetOpenAuth.Test/Mocks/TestWebRequestHandler.cs
@@ -15,8 +15,14 @@ namespace DotNetOpenAuth.Test.Mocks {
internal class TestWebRequestHandler : IWebRequestHandler {
private StringBuilder postEntity;
+ /// <summary>
+ /// Gets or sets the callback used to provide the mock response for the mock request.
+ /// </summary>
internal Func<HttpWebRequest, Response> Callback { get; set; }
+ /// <summary>
+ /// Gets the stream that was written out as if on an HTTP request.
+ /// </summary>
internal Stream RequestEntityStream {
get {
if (this.postEntity == null) {
@@ -26,13 +32,37 @@ namespace DotNetOpenAuth.Test.Mocks {
}
}
+ /// <summary>
+ /// Gets the stream that was written out as if on an HTTP request as an ordinary string.
+ /// </summary>
+ internal string RequestEntityAsString {
+ get {
+ return this.postEntity != null ? this.postEntity.ToString() : null;
+ }
+ }
+
#region IWebRequestHandler Members
+ /// <summary>
+ /// Prepares an <see cref="HttpWebRequest"/> that contains an POST entity for sending the entity.
+ /// </summary>
+ /// <param name="request">The <see cref="HttpWebRequest"/> that should contain the entity.</param>
+ /// <returns>
+ /// The writer the caller should write out the entity data to.
+ /// </returns>
public TextWriter GetRequestStream(HttpWebRequest request) {
this.postEntity = new StringBuilder();
return new StringWriter(this.postEntity);
}
+ /// <summary>
+ /// Processes an <see cref="HttpWebRequest"/> and converts the
+ /// <see cref="HttpWebResponse"/> to a <see cref="Response"/> instance.
+ /// </summary>
+ /// <param name="request">The <see cref="HttpWebRequest"/> to handle.</param>
+ /// <returns>
+ /// An instance of <see cref="Response"/> describing the response.
+ /// </returns>
public Response GetResponse(HttpWebRequest request) {
if (this.Callback == null) {
throw new InvalidOperationException("Set the Callback property first.");