[prev in list] [next in list] [prev in thread] [next in thread]
List: mono-patches
Subject: [Mono-patches] [mono/moon] cd7c4106: Add test case for
From: "Sebastien Pouliot (sebastien () ximian ! com)"
Date: 2011-03-31 20:57:57
Message-ID: 20110331205757.3B70C2212A () mono ! ximian ! com
[Download RAW message or body]
Branch: refs/heads/master
Home: https://github.com/mono/moon
Commit: cd7c4106c605b7619c5d99b79bc1a2721dcf6543
Author: Sebastien Pouliot <sebastien@ximian.com>
Date: 03/31/2011 16:40:07
URL: https://github.com/mono/moon/commit/cd7c4106c605b7619c5d99b79bc1a2721dcf6543
Add test case for DateTImeOffset serialization (676363)
* System.Runtime.Serialization/DataContractSerializerTest.cs: New. Add
unit test based on Atsushi's sample from
http://lists.ximian.com/pipermail/mono-bugs/2011-March/109851.html
Added paths:
A test/2.0/moon-unit/System.Runtime.Serialization/DataContractSerializerTest.cs
Added: test/2.0/moon-unit/System.Runtime.Serialization/DataContractSerializerTest.cs
===================================================================
--- /dev/null
+++ b/test/2.0/moon-unit/System.Runtime.Serialization/DataContractSerializerTest.cs
@@ -0,0 +1,68 @@
+//
+// Unit tests for System.Runtime.Serialization.DataContractSerializer
+//
+// Contact:
+// Moonlight List (moonlight-list@lists.ximian.com)
+//
+// Copyright (C) 2011 Novell, Inc (http://www.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.
+//
+
+using System;
+using System.IO;
+using System.Runtime.Serialization;
+using System.Xml;
+
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+
+namespace MoonTest.System.Runtime.Serialization {
+
+ [TestClass]
+ public class DataContractSerializerTest {
+
+ string Serialize (DataContractSerializer ds, object obj)
+ {
+ StringWriter sw = new StringWriter ();
+ using (XmlWriter xw = XmlWriter.Create (sw)) {
+ ds.WriteObject (xw, obj);
+ }
+ return sw.ToString ();
+ }
+
+ object Deserialize (DataContractSerializer ds, string s)
+ {
+ return ds.ReadObject (XmlReader.Create (new StringReader (s)));
+ }
+
+ [TestMethod]
+ public void RoundTrip_DateTimeOffset ()
+ {
+ var ds = new DataContractSerializer (typeof (DateTimeOffset));
+ DateTimeOffset dto = DateTimeOffset.Now;
+ string s = Serialize (ds, dto);
+
+ DateTimeOffset back = (DateTimeOffset) Deserialize (ds, s);
+ Assert.AreEqual (dto, back, "equals");
+ }
+ }
+}
+
+
_______________________________________________
Mono-patches maillist - Mono-patches@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-patches
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic