Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorMarek Habersack <grendel@twistedcode.net>2010-01-23 01:26:06 +0300
committerMarek Habersack <grendel@twistedcode.net>2010-01-23 01:26:06 +0300
commitbd08ce5b8babde4dca54243d954361b556299595 (patch)
tree5010a9e9c7cf23a7fe29ab5019f1ab3c47c1b37a /mcs
parent0648fa414ebfcac2e7aaa528b5c581307749dbe7 (diff)
2010-01-22 Marek Habersack <mhabersack@novell.com>
* SubstitutionResponseElement.cs: implemented correct (de)serialization of the Callback delegate. * OutputCache.cs: implemented Serialize, Deserialize, DefaultProviderName and Providers. 2010-01-22 Marek Habersack <mhabersack@novell.com> * AssertExtensions.cs: added AreEqual method for comparing byte arrays. 2010-01-22 Marek Habersack <mhabersack@novell.com> * OutputCacheTest.cs: added svn path=/trunk/mcs/; revision=150080
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/System.Web.DynamicData/Test/Common/AssertExtensions.cs62
-rw-r--r--mcs/class/System.Web.DynamicData/Test/Common/ChangeLog5
-rw-r--r--mcs/class/System.Web/System.Web.Caching/ChangeLog8
-rw-r--r--mcs/class/System.Web/System.Web.Caching/OutputCache.cs76
-rw-r--r--mcs/class/System.Web/System.Web.Caching/SubstitutionResponseElement.cs17
-rw-r--r--mcs/class/System.Web/System.Web_test.dll.sources1
-rw-r--r--mcs/class/System.Web/Test/System.Web.Caching/ChangeLog4
-rw-r--r--mcs/class/System.Web/Test/System.Web.Caching/OutputCacheTest.cs313
8 files changed, 463 insertions, 23 deletions
diff --git a/mcs/class/System.Web.DynamicData/Test/Common/AssertExtensions.cs b/mcs/class/System.Web.DynamicData/Test/Common/AssertExtensions.cs
index 3a884ce1a34..41e340bfd35 100644
--- a/mcs/class/System.Web.DynamicData/Test/Common/AssertExtensions.cs
+++ b/mcs/class/System.Web.DynamicData/Test/Common/AssertExtensions.cs
@@ -5,46 +5,78 @@ using NUnit.Framework;
namespace MonoTests.Common
{
- delegate void AssertThrowsDelegate ();
+ delegate void AssertThrowsDelegate();
static class AssertExtensions
{
+ public static void AreEqual (byte[] expected, byte[] data, string message)
+ {
+ if (expected == null) {
+ if (data == null)
+ return;
+ Assert.Fail ("{0}{1}Expected: null{1}Got: byte array with {2} elements and of rank {3}{1}",
+ message, Environment.NewLine, data.Length, data.Rank);
+ }
+
+ if (data == null)
+ Assert.Fail ("{0}{1}Expected: byte array with {2} elements and rank {3}{1}Got: null{1}",
+ message, Environment.NewLine, expected.Length, expected.Rank);
+
+ if (expected.Rank > 1)
+ Assert.Fail ("Only single-dimensional arrays are supported.");
+
+ if (expected.Rank != data.Rank || expected.Length != data.Length)
+ Assert.Fail ("{0}{1}Expected: byte array with {2} elements and rank {3}{1}Got: byte array with {4} elements and rank {5}{1}",
+ message, Environment.NewLine, expected.Length, expected.Rank, data.Length, data.Rank);
+
+ int max = expected.Length;
+ for (int i = 0; i < max; i++) {
+ if (expected[i] != data[i])
+ Assert.Fail ("{0}{1}Arrays differ at index {2}.{1}Expected 0x{3:X} got 0x{4:X}{1}",
+ message, Environment.NewLine, i, expected[i], data[i]);
+ }
+ }
+
public static void Throws<ET> (AssertThrowsDelegate code, string message)
{
- Throws (typeof (ET), code, message);
+ Throws(typeof(ET), code, message);
}
- public static void Throws (Type exceptionType, AssertThrowsDelegate code, string message)
+ public static void Throws(Type exceptionType, AssertThrowsDelegate code, string message)
{
if (code == null)
- Assert.Fail ("No code provided for the test.");
+ Assert.Fail("No code provided for the test.");
Exception exception = null;
- try {
- code ();
- } catch (Exception ex) {
+ try
+ {
+ code();
+ }
+ catch (Exception ex)
+ {
exception = ex;
}
- if (exceptionType == null) {
+ if (exceptionType == null)
+ {
if (exception == null)
- Assert.Fail ("{0}{1}Expected: any exception thrown{1}But was: no exception thrown{1}",
+ Assert.Fail("{0}{1}Expected: any exception thrown{1}But was: no exception thrown{1}",
message, Environment.NewLine);
return;
}
- if (exception == null || exception.GetType () != exceptionType)
- Assert.Fail ("{0}{1}Expected: {2}{1}But was: {3}{1}{4}{1}",
+ if (exception == null || exception.GetType() != exceptionType)
+ Assert.Fail("{0}{1}Expected: {2}{1}But was: {3}{1}{4}{1}",
message,
Environment.NewLine,
exceptionType,
- exception == null ? "no exception" : exception.GetType ().ToString (),
- exception == null ? "no exception" : exception.ToString ());
+ exception == null ? "no exception" : exception.GetType().ToString(),
+ exception == null ? "no exception" : exception.ToString());
}
- public static void Throws (AssertThrowsDelegate code, string message)
+ public static void Throws(AssertThrowsDelegate code, string message)
{
- Throws (null, code, message);
+ Throws(null, code, message);
}
}
}
diff --git a/mcs/class/System.Web.DynamicData/Test/Common/ChangeLog b/mcs/class/System.Web.DynamicData/Test/Common/ChangeLog
index ff5227d54d2..1acc0e7ad47 100644
--- a/mcs/class/System.Web.DynamicData/Test/Common/ChangeLog
+++ b/mcs/class/System.Web.DynamicData/Test/Common/ChangeLog
@@ -1,3 +1,8 @@
+2010-01-22 Marek Habersack <mhabersack@novell.com>
+
+ * AssertExtensions.cs: added AreEqual method for comparing byte
+ arrays.
+
2009-09-18 Marek Habersack <mhabersack@novell.com>
* TestsBasePage.cs: added an event ItemDataBinding, invoked
diff --git a/mcs/class/System.Web/System.Web.Caching/ChangeLog b/mcs/class/System.Web/System.Web.Caching/ChangeLog
index 2088bf0b08a..bd3cf042bbb 100644
--- a/mcs/class/System.Web/System.Web.Caching/ChangeLog
+++ b/mcs/class/System.Web/System.Web.Caching/ChangeLog
@@ -1,3 +1,11 @@
+2010-01-22 Marek Habersack <mhabersack@novell.com>
+
+ * SubstitutionResponseElement.cs: implemented correct
+ (de)serialization of the Callback delegate.
+
+ * OutputCache.cs: implemented Serialize, Deserialize,
+ DefaultProviderName and Providers.
+
2010-01-21 Marek Habersack <mhabersack@novell.com>
* DatabaseNotEnabledForNotificationException.cs, OutputCache.cs,
diff --git a/mcs/class/System.Web/System.Web.Caching/OutputCache.cs b/mcs/class/System.Web/System.Web.Caching/OutputCache.cs
index e8454689898..ca435fde630 100644
--- a/mcs/class/System.Web/System.Web.Caching/OutputCache.cs
+++ b/mcs/class/System.Web/System.Web.Caching/OutputCache.cs
@@ -26,7 +26,9 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System.Configuration;
using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
using System.Security.Permissions;
using System.Web;
using System.Web.Configuration;
@@ -35,12 +37,23 @@ namespace System.Web.Caching
{
public static class OutputCache
{
+ static readonly object initLock = new object ();
+ static bool initialized;
+ static string defaultProviderName;
+ static OutputCacheProviderCollection providers;
+
public static string DefaultProviderName {
- get { throw new NotImplementedException (); }
+ get {
+ Init ();
+ return defaultProviderName;
+ }
}
public static OutputCacheProviderCollection Providers {
- get { throw new NotImplementedException (); }
+ get {
+ Init ();
+ return providers;
+ }
}
[SecurityPermission (SecurityAction.Assert, Flags = SecurityPermissionFlag.SerializationFormatter)]
@@ -49,20 +62,67 @@ namespace System.Web.Caching
if (stream == null)
throw new ArgumentNullException ("stream");
- throw new NotImplementedException ();
-
+ object o = new BinaryFormatter ().Deserialize (stream);
+ if (o == null || IsInvalidType (o))
+ throw new ArgumentException ("The provided parameter is not of a supported type for serialization and/or deserialization.");
+
+ return o;
}
[SecurityPermission (SecurityAction.Assert, Flags = SecurityPermissionFlag.SerializationFormatter)]
public static void Serialize (Stream stream, object data)
{
if (stream == null)
- throw new ArgumentNullException ("stream");
+ throw new ArgumentNullException ("stream");
+
+ // LAMESPEC: data == null doesn't throw ArgumentNullException
+ if (data == null || IsInvalidType (data))
+ throw new ArgumentException ("The provided parameter is not of a supported type for serialization and/or deserialization.");
- if (data == null)
- throw new ArgumentNullException ("data");
+ new BinaryFormatter ().Serialize (stream, data);
+ }
+
+ static bool IsInvalidType (object data)
+ {
+ return !(data is MemoryResponseElement) &&
+ !(data is FileResponseElement) &&
+ !(data is SubstitutionResponseElement);
+ }
+
+ static void Init ()
+ {
+ if (initialized)
+ return;
+
+ lock (initLock) {
+ if (initialized)
+ return;
+
+ var cfg = WebConfigurationManager.GetWebApplicationSection ("system.web/caching/outputCache") as OutputCacheSection;
+ ProviderSettingsCollection cfgProviders = cfg.Providers;
+
+ defaultProviderName = cfg.DefaultProviderName;
+ if (cfgProviders != null && cfgProviders.Count > 0) {
+ var coll = new OutputCacheProviderCollection ();
+
+ foreach (ProviderSettings ps in cfgProviders)
+ coll.Add (LoadProvider (ps));
+
+ coll.SetReadOnly ();
+ providers = coll;
+ }
+
+ initialized = true;
+ }
+ }
+
+ static OutputCacheProvider LoadProvider (ProviderSettings ps)
+ {
+ Type type = HttpApplication.LoadType (ps.Type, true);
+ var ret = Activator.CreateInstance (type) as OutputCacheProvider;
+ ret.Initialize (ps.Name, ps.Parameters);
- throw new NotImplementedException ();
+ return ret;
}
}
}
diff --git a/mcs/class/System.Web/System.Web.Caching/SubstitutionResponseElement.cs b/mcs/class/System.Web/System.Web.Caching/SubstitutionResponseElement.cs
index ec3a9fa657b..5a37b3e1283 100644
--- a/mcs/class/System.Web/System.Web.Caching/SubstitutionResponseElement.cs
+++ b/mcs/class/System.Web/System.Web.Caching/SubstitutionResponseElement.cs
@@ -26,6 +26,9 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using System;
+using System.Reflection;
+using System.Runtime.Serialization;
using System.Security.Permissions;
using System.Web;
@@ -35,6 +38,9 @@ namespace System.Web.Caching
[AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Unrestricted)]
public class SubstitutionResponseElement : ResponseElement
{
+ string typeName;
+ string methodName;
+
public HttpResponseSubstitutionCallback Callback {
get;
private set;
@@ -46,6 +52,17 @@ namespace System.Web.Caching
throw new ArgumentNullException ("callback");
this.Callback = callback;
+
+ MethodInfo mi = callback.Method;
+ this.typeName = mi.DeclaringType.AssemblyQualifiedName;
+ this.methodName = mi.Name;
+ }
+
+ [OnDeserialized]
+ void ObjectDeserialized (StreamingContext context)
+ {
+ Type type = Type.GetType (typeName, true);
+ Callback = Delegate.CreateDelegate (typeof (HttpResponseSubstitutionCallback), type, methodName, false, true) as HttpResponseSubstitutionCallback;
}
}
}
diff --git a/mcs/class/System.Web/System.Web_test.dll.sources b/mcs/class/System.Web/System.Web_test.dll.sources
index 99f7ba6be0a..791a742651d 100644
--- a/mcs/class/System.Web/System.Web_test.dll.sources
+++ b/mcs/class/System.Web/System.Web_test.dll.sources
@@ -338,6 +338,7 @@ System.Web.Caching/CacheDependencyCas.cs
System.Web.Caching/FileResponseElementTest.cs
System.Web.Caching/HeaderElementTest.cs
System.Web.Caching/MemoryResponseElementTest.cs
+System.Web.Caching/OutputCacheTest.cs
System.Web.Caching/SubstitutionResponseElementTest.cs
System.Web.Configuration/HttpCapabilitiesBaseCas.cs
System.Web.Handlers/TraceHandlerCas.cs
diff --git a/mcs/class/System.Web/Test/System.Web.Caching/ChangeLog b/mcs/class/System.Web/Test/System.Web.Caching/ChangeLog
index 96590822182..949aaa2e292 100644
--- a/mcs/class/System.Web/Test/System.Web.Caching/ChangeLog
+++ b/mcs/class/System.Web/Test/System.Web.Caching/ChangeLog
@@ -1,3 +1,7 @@
+2010-01-22 Marek Habersack <mhabersack@novell.com>
+
+ * OutputCacheTest.cs: added
+
2010-01-21 Marek Habersack <mhabersack@novell.com>
* FileResponseElementTest.cs, HeaderElementTest.cs,
diff --git a/mcs/class/System.Web/Test/System.Web.Caching/OutputCacheTest.cs b/mcs/class/System.Web/Test/System.Web.Caching/OutputCacheTest.cs
new file mode 100644
index 00000000000..85a79dc4e1b
--- /dev/null
+++ b/mcs/class/System.Web/Test/System.Web.Caching/OutputCacheTest.cs
@@ -0,0 +1,313 @@
+// Authors:
+// Marek Habersack <mhabersack@novell.com>
+//
+// Copyright (C) 2010 Novell Inc. http://novell.com
+//
+
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#if NET_4_0
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.IO;
+using System.Runtime.Serialization.Formatters.Binary;
+using System.Text;
+using System.Web;
+using System.Web.Caching;
+using System.Web.Configuration;
+
+using NUnit.Framework;
+using MonoTests.Common;
+
+namespace MonoTests.System.Web.Caching
+{
+ public class TestOutputCacheProvider : OutputCacheProvider
+ {
+ Dictionary<string, object> data = new Dictionary<string, object> ();
+
+ public override object Add (string key, object entry, DateTime utcExpiry)
+ {
+ if (data.ContainsKey (key))
+ data[key] = entry;
+ else
+ data.Add (key, entry);
+
+ return entry;
+ }
+
+ public override object Get (string key)
+ {
+ object o;
+
+ if (data.TryGetValue (key, out o))
+ return o;
+
+ return null;
+ }
+
+ public override void Remove (string key)
+ {
+ if (data.ContainsKey (key))
+ data.Remove (key);
+ }
+
+ public override void Set (string key, object entry, DateTime utcExpiry)
+ {
+ if (data.ContainsKey (key))
+ data[key] = entry;
+ }
+ }
+
+ [Serializable]
+ class TestResponseElement : ResponseElement
+ {
+ public string Text
+ {
+ get;
+ private set;
+ }
+
+ public TestResponseElement (string text)
+ {
+ this.Text = text;
+ }
+ }
+
+ [TestFixture]
+ [Serializable]
+ public class OutputCacheTest
+ {
+ [Test]
+ public void DefaultProviderName ()
+ {
+ Assert.AreEqual ("AspNetInternalProvider", OutputCache.DefaultProviderName, "#A1");
+
+ var ocs = WebConfigurationManager.GetWebApplicationSection ("system.web/caching/outputCache") as OutputCacheSection;
+ Assert.AreEqual (ocs.DefaultProviderName, OutputCache.DefaultProviderName, "#B1");
+ }
+
+ [Test]
+ public void Providers ()
+ {
+ var ocs = WebConfigurationManager.GetWebApplicationSection ("system.web/caching/outputCache") as OutputCacheSection;
+ OutputCacheProviderCollection coll = OutputCache.Providers;
+
+ Assert.IsNull (coll, "#A1");
+ Assert.IsNotNull (ocs.Providers, "#B1-1");
+ Assert.AreEqual (0, ocs.Providers.Count, "#B1-2");
+ }
+
+ string DummyBadSubstitutionCallback (HttpContext ctx)
+ {
+ return "string";
+ }
+
+ static string DummySubstitutionCallback (HttpContext ctx)
+ {
+ return "string";
+ }
+
+ // Serialized elements for the Serialize test below
+#if TARGET_DOTNET
+ static readonly byte[] memoryResponseElement = { 0x0, 0x1, 0x0, 0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xC, 0x2, 0x0, 0x0, 0x0, 0x4D, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x57, 0x65, 0x62, 0x2C, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x34, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x2C, 0x20, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x3D, 0x6E, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6C, 0x2C, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x63, 0x4B, 0x65, 0x79, 0x54, 0x6F, 0x6B, 0x65, 0x6E, 0x3D, 0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0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x57, 0x65, 0x62, 0x2C, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x34, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x2C, 0x20, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x3D, 0x6E, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6C, 0x2C, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x63, 0x4B, 0x65, 0x79, 0x54, 0x6F, 0x6B, 0x65, 0x6E, 0x3D, 0x62, 0x30, 0x33, 0x66, 0x35, 0x66, 0x37, 0x66, 0x31, 0x31, 0x64, 0x35, 0x30, 0x61, 0x33, 0x61, 0x5, 0x1, 0x0, 0x0, 0x0, 0x26, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x57, 0x65, 0x62, 0x2E, 0x43, 0x61, 0x63, 0x68, 0x69, 0x6E, 0x67, 0x2E, 0x46, 0x69, 0x6C, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6F, 0x6E, 0x73, 0x65, 0x45, 0x6C, 0x65, 0x6D, 0x65, 0x6E, 0x74, 0x3, 0x0, 0x0, 0x0, 0x5, 0x5F, 0x70, 0x61, 0x74, 0x68, 0x7, 0x5F, 0x6F, 0x66, 0x66, 0x73, 0x65, 0x74, 0x7, 0x5F, 0x6C, 0x65, 0x6E, 0x67, 0x74, 0x68, 0x1, 0x0, 0x0, 0x9, 0x9, 0x2, 0x0, 0x0, 0x0, 0x6, 0x3, 0x0, 0x0, 0x0, 0x11, 0x2F, 0x70, 0x61, 0x74, 0x68, 0x2F, 0x74, 0x6F, 0x2F, 0x66, 0x69, 0x6C, 0x65, 0x2E, 0x74, 0x78, 0x74, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xD2, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xB, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 };
+ static readonly byte[] substitutionResponseElement = { 0x0, 0x1, 0x0, 0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xC, 0x2, 0x0, 0x0, 0x0, 0x4D, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x57, 0x65, 0x62, 0x2C, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x3D, 0x34, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x2C, 0x20, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x3D, 0x6E, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6C, 0x2C, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x63, 0x4B, 0x65, 0x79, 0x54, 0x6F, 0x6B, 0x65, 0x6E, 0x3D, 0x62, 0x30, 0x33, 0x66, 0x35, 0x66, 0x37, 0x66, 0x31, 0x31, 0x64, 0x35, 0x30, 0x61, 0x33, 0x61, 0x5, 0x1, 0x0, 0x0, 0x0, 0x2E, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x57, 0x65, 0x62, 0x2E, 0x43, 0x61, 0x63, 0x68, 0x69, 0x6E, 0x67, 0x2E, 0x53, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x69, 0x6F, 0x6E, 0x52, 0x65, 0x73, 0x70, 0x6F, 0x6E, 0x73, 0x65, 0x45, 0x6C, 0x65, 0x6D, 0x65, 0x6E, 0x74, 0x2, 0x0, 0x0, 0x0, 0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6F, 0x6E, 0x3D, 0x34, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x30, 0x2C, 0x20, 0x43, 0x75, 0x6C, 0x74, 0x75, 0x72, 0x65, 0x3D, 0x6E, 0x65, 0x75, 0x74, 0x72, 0x61, 0x6C, 0x2C, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x63, 0x4B, 0x65, 0x79, 0x54, 0x6F, 0x6B, 0x65, 0x6E, 0x3D, 0x62, 0x30, 0x33, 0x66, 0x35, 0x66, 0x37, 0x66, 0x31, 0x31, 0x64, 0x35, 0x30, 0x61, 0x33, 0x61, 0x5, 0x1, 0x0, 0x0, 0x0, 0x2E, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x57, 0x65, 0x62, 0x2E, 0x43, 0x61, 0x63, 0x68, 0x69, 0x6E, 0x67, 0x2E, 0x53, 0x75, 0x62, 0x73, 0x74, 0x69, 0x74, 0x75, 0x74, 0x69, 0x6F, 0x6E, 0x52, 0x65, 0x73, 0x70, 0x6F, 0x6E, 0x73, 0x65, 0x45, 0x6C, 0x65, 0x6D, 0x65, 0x6E, 0x74, 0x2, 0x0, 0x0, 0x0, 0xF, 0x5F, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x4E, 0x61, 0x6D, 0x65, 0xB, 0x5F, 0x6D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x4E, 0x61, 0x6D, 0x65, 0x1, 0x1, 0x2, 0x0, 0x0, 0x0, 0x6, 0x3, 0x0, 0x0, 0x0, 0x41, 0x4D, 0x6F, 0x6E, 0x6F, 0x54, 0x65, 0x73, 0x74, 0x73, 0x2E, 0x53, 0x79, 0x73, 0x74, 0x65, 0x6D, 0x2E, 0x57, 0x65, 0x62, 0x2E, 0x43, 0x61, 0x63, 0x68, 0x69, 0x6E, 0x67, 0x2E, 0x4F, 0x75, 0x74, 0x70, 0x75, 0x74, 0x43, 0x61, 0x63, 0x68, 0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,0x0,0x0,0x0,0x0,0x0,0xF,0x3,0x0,0x0,0x0,0xC,0x0,0x0,0x0,0x2,0x45,0x6E,0x63,0x6F,0x64,0x65,0x64,0x20,0x64,0x61,0x74,0x61,0xB,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
+ static readonly byte[] fileResponseElement = {0x0,0x1,0x0,0x0,0x0,0xFF,0xFF,0xFF,0xFF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xC,0x2,0x0,0x0,0x0,0xA,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x5,0x1,0x0,0x0,0x0,0x26,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x46,0x69,0x6C,0x65,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x45,0x6C,0x65,0x6D,0x65,0x6E,0x74,0x3,0x0,0x0,0x0,0x17,0x3C,0x4C,0x65,0x6E,0x67,0x74,0x68,0x3E,0x6B,0x5F,0x5F,0x42,0x61,0x63,0x6B,0x69,0x6E,0x67,0x46,0x69,0x65,0x6C,0x64,0x17,0x3C,0x4F,0x66,0x66,0x73,0x65,0x74,0x3E,0x6B,0x5F,0x5F,0x42,0x61,0x63,0x6B,0x69,0x6E,0x67,0x46,0x69,0x65,0x6C,0x64,0x15,0x3C,0x50,0x61,0x74,0x68,0x3E,0x6B,0x5F,0x5F,0x42,0x61,0x63,0x6B,0x69,0x6E,0x67,0x46,0x69,0x65,0x6C,0x64,0x0,0x0,0x1,0x9,0x9,0x2,0x0,0x0,0x0,0xD2,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x3,0x0,0x0,0x0,0x11,0x2F,0x70,0x61,0x74,0x68,0x2F,0x74,0x6F,0x2F,0x66,0x69,0x6C,0x65,0x2E,0x74,0x78,0x74,0xB,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
+ static readonly byte[] substitutionResponseElement = {0x0,0x1,0x0,0x0,0x0,0xFF,0xFF,0xFF,0xFF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xC,0x2,0x0,0x0,0x0,0xA,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x5,0x1,0x0,0x0,0x0,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x45,0x6C,0x65,0x6D,0x65,0x6E,0x74,0x3,0x0,0x0,0x0,0x8,0x74,0x79,0x70,0x65,0x4E,0x61,0x6D,0x65,0xA,0x6D,0x65,0x74,0x68,0x6F,0x64,0x4E,0x61,0x6D,0x65,0x19,0x3C,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x3E,0x6B,0x5F,0x5F,0x42,0x61,0x63,0x6B,0x69,0x6E,0x67,0x46,0x69,0x65,0x6C,0x64,0x1,0x1,0x4,0x2B,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x2,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x6,0x3,0x0,0x0,0x0,0x88,0x1,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x2C,0x20,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x5F,0x74,0x65,0x73,0x74,0x5F,0x6E,0x65,0x74,0x5F,0x34,0x5F,0x30,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x31,0x2E,0x33,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x33,0x31,0x62,0x66,0x33,0x38,0x35,0x36,0x61,0x64,0x33,0x36,0x34,0x65,0x33,0x35,0x6,0x4,0x0,0x0,0x0,0x19,0x44,0x75,0x6D,0x6D,0x79,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x9,0x5,0x0,0x0,0x0,0x4,0x5,0x0,0x0,0x0,0x22,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x1,0x0,0x0,0x0,0x8,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x3,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x9,0x6,0x0,0x0,0x0,0x4,0x6,0x0,0x0,0x0,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x7,0x0,0x0,0x0,0x4,0x74,0x79,0x70,0x65,0x8,0x61,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0x6,0x74,0x61,0x72,0x67,0x65,0x74,0x12,0x74,0x61,0x72,0x67,0x65,0x74,0x54,0x79,0x70,0x65,0x41,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0xE,0x74,0x61,0x72,0x67,0x65,0x74,0x54,0x79,0x70,0x65,0x4E,0x61,0x6D,0x65,0xA,0x6D,0x65,0x74,0x68,0x6F,0x64,0x4E,0x61,0x6D,0x65,0xD,0x64,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x1,0x1,0x2,0x1,0x1,0x1,0x3,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x6,0x7,0x0,0x0,0x0,0x2B,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x6,0x8,0x0,0x0,0x0,0x4D,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x34,0x2E,0x30,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x62,0x30,0x33,0x66,0x35,0x66,0x37,0x66,0x31,0x31,0x64,0x35,0x30,0x61,0x33,0x61,0xA,0x6,0x9,0x0,0x0,0x0,0x5A,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x5F,0x74,0x65,0x73,0x74,0x5F,0x6E,0x65,0x74,0x5F,0x34,0x5F,0x30,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x31,0x2E,0x33,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x33,0x31,0x62,0x66,0x33,0x38,0x35,0x36,0x61,0x64,0x33,0x36,0x34,0x65,0x33,0x35,0x6,0xA,0x0,0x0,0x0,0x2C,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x9,0x4,0x0,0x0,0x0,0xA,0xB,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
+ static readonly byte[] badSubstitutionResponseElement = {0x0,0x1,0x0,0x0,0x0,0xFF,0xFF,0xFF,0xFF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xC,0x2,0x0,0x0,0x0,0xA,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x5,0x1,0x0,0x0,0x0,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x45,0x6C,0x65,0x6D,0x65,0x6E,0x74,0x3,0x0,0x0,0x0,0x8,0x74,0x79,0x70,0x65,0x4E,0x61,0x6D,0x65,0xA,0x6D,0x65,0x74,0x68,0x6F,0x64,0x4E,0x61,0x6D,0x65,0x19,0x3C,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x3E,0x6B,0x5F,0x5F,0x42,0x61,0x63,0x6B,0x69,0x6E,0x67,0x46,0x69,0x65,0x6C,0x64,0x1,0x1,0x4,0x2B,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x2,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x6,0x3,0x0,0x0,0x0,0x88,0x1,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x2C,0x20,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x5F,0x74,0x65,0x73,0x74,0x5F,0x6E,0x65,0x74,0x5F,0x34,0x5F,0x30,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x31,0x2E,0x33,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x33,0x31,0x62,0x66,0x33,0x38,0x35,0x36,0x61,0x64,0x33,0x36,0x34,0x65,0x33,0x35,0x6,0x4,0x0,0x0,0x0,0x1C,0x44,0x75,0x6D,0x6D,0x79,0x42,0x61,0x64,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x9,0x5,0x0,0x0,0x0,0xC,0x6,0x0,0x0,0x0,0x17,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x5F,0x74,0x65,0x73,0x74,0x5F,0x6E,0x65,0x74,0x5F,0x34,0x5F,0x30,0x4,0x5,0x0,0x0,0x0,0x22,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2,0x0,0x0,0x0,0x8,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x7,0x74,0x61,0x72,0x67,0x65,0x74,0x30,0x3,0x4,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x2C,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x6,0x0,0x0,0x0,0x9,0x7,0x0,0x0,0x0,0x9,0x8,0x0,0x0,0x0,0x4,0x7,0x0,0x0,0x0,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x7,0x0,0x0,0x0,0x4,0x74,0x79,0x70,0x65,0x8,0x61,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0x6,0x74,0x61,0x72,0x67,0x65,0x74,0x12,0x74,0x61,0x72,0x67,0x65,0x74,0x54,0x79,0x70,0x65,0x41,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0xE,0x74,0x61,0x72,0x67,0x65,0x74,0x54,0x79,0x70,0x65,0x4E,0x61,0x6D,0x65,0xA,0x6D,0x65,0x74,0x68,0x6F,0x64,0x4E,0x61,0x6D,0x65,0xD,0x64,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x1,0x1,0x2,0x1,0x1,0x1,0x3,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x6,0x9,0x0,0x0,0x0,0x2B,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x6,0xA,0x0,0x0,0x0,0x4D,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x34,0x2E,0x30,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x62,0x30,0x33,0x66,0x35,0x66,0x37,0x66,0x31,0x31,0x64,0x35,0x30,0x61,0x33,0x61,0x6,0xB,0x0,0x0,0x0,0x7,0x74,0x61,0x72,0x67,0x65,0x74,0x30,0x6,0xC,0x0,0x0,0x0,0x5A,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x5F,0x74,0x65,0x73,0x74,0x5F,0x6E,0x65,0x74,0x5F,0x34,0x5F,0x30,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x31,0x2E,0x33,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x33,0x31,0x62,0x66,0x33,0x38,0x35,0x36,0x61,0x64,0x33,0x36,0x34,0x65,0x33,0x35,0x6,0xD,0x0,0x0,0x0,0x2C,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0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,0x0,0x0};
+#endif
+
+ static readonly object[] serializeObjects = {
+ (object)new object (),
+ (bool)true,
+ (char)'a',
+ (sbyte)-128,
+ (byte)128,
+ (short)-32768,
+ (ushort)65535,
+ (int)2147483647,
+ (uint)4294967295,
+ (long)9223372036854775807,
+ (ulong)18446744073709551615,
+ (float)3.402823E+38F,
+ (double)1.79769313486232E+307D,
+ (decimal)79228162514264337593543950335M,
+ (string)"string",
+ (DateTime)DateTime.Now,
+ (DBNull)DBNull.Value,
+ (TestResponseElement)new TestResponseElement ("text"),
+ (HeaderElement)new HeaderElement ("name", "value")
+ };
+
+ [Test]
+ public void Serialize ()
+ {
+ ResponseElement data = new MemoryResponseElement (new byte[10], 10);
+
+ AssertExtensions.Throws<ArgumentNullException> (() => {
+ OutputCache.Serialize (null, data);
+ }, "#A1");
+
+ var ms = new MemoryStream ();
+ AssertExtensions.Throws<ArgumentException> (() => {
+ OutputCache.Serialize (ms, null);
+ }, "#A2");
+
+ foreach (object o in serializeObjects) {
+ AssertExtensions.Throws<ArgumentException> (() => {
+ OutputCache.Serialize (ms, o);
+ }, String.Format ("#A3-{0}", o.GetType ()));
+ }
+
+ MemoryResponseElement mre;
+ FileResponseElement fre;
+ SubstitutionResponseElement sre, sreBad;
+
+ CreateElements (out mre, out fre, out sre, out sreBad);
+ // WriteSerializedBytes ("/tmp/bytes.txt", "memoryResponseElement", mre);
+ // WriteSerializedBytes ("/tmp/bytes.txt", "fileResponseElement", fre);
+ // WriteSerializedBytes ("/tmp/bytes.txt", "substitutionResponseElement", sre);
+ // WriteSerializedBytes ("/tmp/bytes.txt", "badSubstitutionResponseElement", sreBad);
+
+ byte[] bytes = SerializeElement (mre);
+ AssertExtensions.AreEqual (bytes, memoryResponseElement, "#B1");
+
+ bytes = SerializeElement (fre);
+ AssertExtensions.AreEqual (bytes, fileResponseElement, "#B2");
+
+ bytes = SerializeElement (sre);
+ AssertExtensions.AreEqual (bytes, substitutionResponseElement, "#B3");
+
+ bytes = SerializeElement (sreBad);
+ AssertExtensions.AreEqual (bytes, badSubstitutionResponseElement, "#B3");
+ }
+
+ [Test]
+ public void Deserialize ()
+ {
+ AssertExtensions.Throws<ArgumentNullException> (() => {
+ OutputCache.Deserialize (null);
+ }, "#A1");
+
+ foreach (object o in serializeObjects) {
+ using (var m = new MemoryStream (SerializeToBinary (o))) {
+ AssertExtensions.Throws<ArgumentException> (() => {
+ OutputCache.Deserialize (m);
+ }, String.Format ("#A2-{0}", o.GetType ()));
+ }
+ }
+
+ MemoryResponseElement mre, mreOrig;
+ FileResponseElement fre, freOrig;
+ SubstitutionResponseElement sre, sreOrig, sreBad, sreBadOrig;
+ MemoryStream ms;
+
+ CreateElements (out mre, out fre, out sre, out sreBad);
+
+ using (ms = new MemoryStream (memoryResponseElement))
+ mreOrig = OutputCache.Deserialize (ms) as MemoryResponseElement;
+ Assert.IsNotNull (mreOrig, "#B1-1");
+ AssertExtensions.AreEqual (mreOrig.Buffer, mre.Buffer, "#B1-2");
+ Assert.AreEqual (mreOrig.Length, mre.Length, "#B1-3");
+
+ using (ms = new MemoryStream (fileResponseElement))
+ freOrig = OutputCache.Deserialize (ms) as FileResponseElement;
+ Assert.IsNotNull (freOrig, "#C1-1");
+ Assert.AreEqual (freOrig.Length, fre.Length, "#C1-2");
+ Assert.AreEqual (freOrig.Offset, fre.Offset, "#C1-3");
+ Assert.AreEqual (freOrig.Path, fre.Path, "#C1-4");
+
+ using (ms = new MemoryStream (substitutionResponseElement))
+ sreOrig = OutputCache.Deserialize (ms) as SubstitutionResponseElement;
+ Assert.IsNotNull (sreOrig);
+ Assert.AreEqual (sreOrig.Callback, sre.Callback, "#D1");
+
+ // Callback here is not a static method - Substitution delegates must be static
+ AssertExtensions.Throws<ArgumentException> (() => {
+ using (ms = new MemoryStream (badSubstitutionResponseElement))
+ sreBadOrig = OutputCache.Deserialize (ms) as SubstitutionResponseElement;
+ }, "#E1");
+ }
+
+ void CreateElements (out MemoryResponseElement mre, out FileResponseElement fre, out SubstitutionResponseElement sre,
+ out SubstitutionResponseElement sreBad)
+ {
+ byte[] bytes = Encoding.UTF8.GetBytes ("Encoded data");
+ mre = new MemoryResponseElement (bytes, bytes.Length);
+ fre = new FileResponseElement ("/path/to/file.txt", 0, 1234);
+ sre = new SubstitutionResponseElement (new HttpResponseSubstitutionCallback (DummySubstitutionCallback));
+ sreBad = new SubstitutionResponseElement (new HttpResponseSubstitutionCallback (DummyBadSubstitutionCallback));
+ }
+
+ byte[] SerializeToBinary (object o)
+ {
+ using (var ms = new MemoryStream ()) {
+ var fmt = new BinaryFormatter ();
+ fmt.Serialize (ms, o);
+ ms.Flush ();
+ return ms.GetBuffer ();
+ }
+ }
+
+ byte[] SerializeElement (ResponseElement e)
+ {
+ using (var ms = new MemoryStream ()) {
+ OutputCache.Serialize (ms, e);
+ ms.Flush ();
+ return ms.GetBuffer ();
+ }
+ }
+
+ // A helper method should one want to add new serialized type arrays
+ void WriteSerializedBytes (string filePath, string varName, object data)
+ {
+ byte[] bytes;
+ using (var ms = new MemoryStream ()) {
+ OutputCache.Serialize (ms, data);
+ ms.Flush ();
+ bytes = ms.GetBuffer ();
+
+ if (bytes == null)
+ return;
+
+ using (var sw = File.AppendText (filePath)) {
+ sw.Write ("byte[] {0} = {{", varName);
+
+ bool first = true;
+ foreach (byte b in bytes) {
+ if (first)
+ first = false;
+ else
+ sw.Write (",");
+ sw.Write ("0x{0:X}", b);
+ }
+ sw.WriteLine ("};");
+ }
+ }
+ }
+ }
+}
+#endif