summaryrefslogtreecommitdiffstats
path: root/src/DotNetOpenAuth.Test/TestUtilities.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/DotNetOpenAuth.Test/TestUtilities.cs')
-rw-r--r--src/DotNetOpenAuth.Test/TestUtilities.cs21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/DotNetOpenAuth.Test/TestUtilities.cs b/src/DotNetOpenAuth.Test/TestUtilities.cs
index cf9b5a3..a526f7f 100644
--- a/src/DotNetOpenAuth.Test/TestUtilities.cs
+++ b/src/DotNetOpenAuth.Test/TestUtilities.cs
@@ -7,16 +7,35 @@
namespace DotNetOpenAuth.Test {
using System;
using System.Collections.Generic;
+ using System.Collections.Specialized;
using System.Linq;
+ using System.Net;
using log4net;
/// <summary>
/// An assortment of methods useful for testing.
/// </summary>
- internal class TestUtilities {
+ internal static class TestUtilities {
/// <summary>
/// The logger that tests should use.
/// </summary>
internal static readonly ILog TestLogger = LogManager.GetLogger("DotNetOpenAuth.Test");
+
+ internal static void ApplyTo(this NameValueCollection source, NameValueCollection target) {
+ Requires.NotNull(source, "source");
+ Requires.NotNull(target, "target");
+
+ foreach (string header in source) {
+ target[header] = source[header];
+ }
+ }
+
+ internal static T Clone<T>(this T source) where T : NameValueCollection, new() {
+ Requires.NotNull(source, "source");
+
+ var result = new T();
+ ApplyTo(source, result);
+ return result;
+ }
}
}