Update of /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Expressions
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv31381/Expressions
Modified Files:
ExpressionEvaluatorTests.cs
Log Message:
Add SOAP serialization tests to ExpressionEvaluatorTests
Index: ExpressionEvaluatorTests.cs
===================================================================
RCS file: /cvsroot/springnet/Spring.Net/test/Spring/Spring.Core.Tests/Expressions/ExpressionEvaluatorTests.cs,v
retrieving revision 1.67
retrieving revision 1.68
diff -C2 -d -r1.67 -r1.68
*** ExpressionEvaluatorTests.cs 26 Aug 2007 02:00:00 -0000 1.67
--- ExpressionEvaluatorTests.cs 7 Sep 2007 01:54:59 -0000 1.68
***************
*** 30,33 ****
--- 30,35 ----
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
+ using System.Runtime.Serialization.Formatters.Soap;
+ using System.Text;
using System.Threading;
using System.Web.Services;
***************
*** 189,192 ****
--- 191,195 ----
// serialize and deserialize it
exp = SerializeDeserializeExpression(exp);
+ exp = SerializeDeserializeExpressionUsingSoap(exp);
}
}
***************
*** 245,248 ****
--- 248,272 ----
}
+ private static IExpression SerializeDeserializeExpressionUsingSoap(IExpression exp)
+ {
+ string xml;
+ SoapFormatter formatter = new SoapFormatter();
+ using (MemoryStream ms = new MemoryStream())
+ {
+ formatter.Serialize(ms, exp);
+ ms.Position = 0;
+ byte[] b = new byte[ms.Length];
+ ms.Read(b, 0, (int)ms.Length);
+ xml = Encoding.ASCII.GetString(b, 0, b.Length);
+ }
+ using (StringReader sr = new StringReader(xml))
+ {
+ byte[] b = Encoding.ASCII.GetBytes(xml);
+ Stream stream = new MemoryStream(b);
+ exp = (IExpression) formatter.Deserialize(stream);
+ }
+ return exp;
+ }
+
#endregion Serialization Tests
***************
*** 758,761 ****
--- 782,786 ----
}
+
/// <summary>
/// Try to set 'this' variable
***************
*** 2850,2852 ****
--- 2875,2879 ----
#endregion // Shadowing Test Helper Classes
+
+
}
|