Changeset 1734 for trunk/sources/HeuristicLab.Persistence
- Timestamp:
- 05/04/09 16:50:34 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.Persistence
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlParser.cs
r1703 r1734 122 122 } 123 123 124 public static object DeSerialize(string filename) { 125 try { 126 ZipFile zipFile = new ZipFile(filename); 124 public static object Deserialize(string filename) { 125 return Deserialize(new ZipFile(filename)); 126 } 127 128 public static object Deserialize(Stream stream) { 129 return Deserialize(new ZipFile(stream)); 130 } 131 132 private static object Deserialize(ZipFile zipFile) { 133 try { 127 134 Deserializer deSerializer = new Deserializer( 128 135 ParseTypeCache( -
trunk/sources/HeuristicLab.Persistence/UnitTests/UseCases.cs
r1733 r1734 219 219 r.uninitialized = null; 220 220 XmlGenerator.Serialize(r, tempFile); 221 Root newR = (Root)XmlParser.De Serialize(tempFile);221 Root newR = (Root)XmlParser.Deserialize(tempFile); 222 222 Assert.AreEqual( 223 223 DebugStringGenerator.Serialize(r), … … 283 283 c.kvpList = new KeyValuePair<List<C>, C>(new List<C> { c }, c); 284 284 XmlGenerator.Serialize(cs, tempFile); 285 object o = XmlParser.De Serialize(tempFile);285 object o = XmlParser.Deserialize(tempFile); 286 286 Assert.AreEqual( 287 287 DebugStringGenerator.Serialize(cs), … … 315 315 arrayListArray[2].Add(a); 316 316 XmlGenerator.Serialize(arrayListArray, tempFile); 317 object o = XmlParser.De Serialize(tempFile);317 object o = XmlParser.Deserialize(tempFile); 318 318 Assert.AreEqual( 319 319 DebugStringGenerator.Serialize(arrayListArray), … … 330 330 Manager m = new Manager(); 331 331 XmlGenerator.Serialize(m, tempFile); 332 Manager newM = (Manager)XmlParser.De Serialize(tempFile);332 Manager newM = (Manager)XmlParser.Deserialize(tempFile); 333 333 Assert.AreNotEqual( 334 334 DebugStringGenerator.Serialize(m), … … 344 344 PrimitivesTest sdt = new PrimitivesTest(); 345 345 XmlGenerator.Serialize(sdt, tempFile); 346 object o = XmlParser.De Serialize(tempFile);346 object o = XmlParser.Deserialize(tempFile); 347 347 Assert.AreEqual( 348 348 DebugStringGenerator.Serialize(sdt), … … 357 357 }; 358 358 XmlGenerator.Serialize(mDimString, tempFile); 359 object o = XmlParser.De Serialize(tempFile);359 object o = XmlParser.Deserialize(tempFile); 360 360 Assert.AreEqual( 361 361 DebugStringGenerator.Serialize(mDimString), … … 372 372 NestedType t = new NestedType(); 373 373 XmlGenerator.Serialize(t, tempFile); 374 object o = XmlParser.De Serialize(tempFile);374 object o = XmlParser.Deserialize(tempFile); 375 375 Assert.AreEqual( 376 376 DebugStringGenerator.Serialize(t), … … 383 383 string[] strings = { "ora", "et", "labora" }; 384 384 XmlGenerator.Serialize(strings, tempFile); 385 object o = XmlParser.De Serialize(tempFile);385 object o = XmlParser.Deserialize(tempFile); 386 386 Assert.AreEqual( 387 387 DebugStringGenerator.Serialize(strings), … … 400 400 public void PrimitiveRoot() { 401 401 XmlGenerator.Serialize(12.3f, tempFile); 402 object o = XmlParser.De Serialize(tempFile);402 object o = XmlParser.Deserialize(tempFile); 403 403 Assert.AreEqual( 404 404 DebugStringGenerator.Serialize(12.3f), … … 456 456 new StorableDecomposer(), 457 457 new Number2StringDecomposer() })); 458 object o = XmlParser.De Serialize(tempFile);458 object o = XmlParser.Deserialize(tempFile); 459 459 Assert.AreEqual( 460 460 DebugStringGenerator.Serialize(sdt), … … 467 467 et.OnChange += (o) => o; 468 468 XmlGenerator.Serialize(et, tempFile); 469 EventTest newEt = (EventTest)XmlParser.De Serialize(tempFile);469 EventTest newEt = (EventTest)XmlParser.Deserialize(tempFile); 470 470 } 471 471 … … 477 477 et.trickyEnum = TrickyEnum.two | TrickyEnum.one; 478 478 XmlGenerator.Serialize(et, tempFile); 479 EnumTest newEt = (EnumTest)XmlParser.De Serialize(tempFile);479 EnumTest newEt = (EnumTest)XmlParser.Deserialize(tempFile); 480 480 Assert.AreEqual(et.simpleEnum, SimpleEnum.two); 481 481 Assert.AreEqual(et.complexEnum, ComplexEnum.three); … … 491 491 Assert.AreNotSame(ints[0], ints[1]); 492 492 XmlGenerator.Serialize(ints, tempFile); 493 List<IntWrapper> newInts = (List<IntWrapper>)XmlParser.De Serialize(tempFile);493 List<IntWrapper> newInts = (List<IntWrapper>)XmlParser.Deserialize(tempFile); 494 494 Assert.AreEqual(newInts[0].Value, 1); 495 495 Assert.AreEqual(newInts[1].Value, 1); … … 517 517 Assert.Fail("Exception expected"); 518 518 } catch (PersistenceException) { } 519 List<int> newList = (List<int>)XmlParser.De Serialize(tempFile);519 List<int> newList = (List<int>)XmlParser.Deserialize(tempFile); 520 520 Assert.AreEqual(list[0], newList[0]); 521 521 Assert.AreEqual(list[1], newList[1]);
Note: See TracChangeset
for help on using the changeset viewer.