Changeset 13370 for branches/PersistenceOverhaul
- Timestamp:
- 11/24/15 17:10:41 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PersistenceOverhaul/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/UseCases.cs
r13368 r13370 639 639 XmlGenerator.Serialize(c, tempFile); 640 640 Assert.Fail("Exception not thrown"); 641 } catch (PersistenceException) { 641 } 642 catch (PersistenceException) { 642 643 } 643 644 } … … 653 654 XmlGenerator.Serialize(s, tempFile); 654 655 Assert.Fail("Exception expected"); 655 } catch (PersistenceException) { } 656 } 657 catch (PersistenceException) { } 656 658 List<int> newList = (List<int>)XmlParser.Deserialize(tempFile); 657 659 Assert.AreEqual(list[0], newList[0]); … … 698 700 } 699 701 Assert.Fail("Exception expected"); 700 } catch (PersistenceException px) { 702 } 703 catch (PersistenceException px) { 701 704 Assert.AreEqual(3, px.Data.Count); 702 705 } … … 728 731 d = new Deserializer(XmlParser.ParseTypeCache(new StringReader(newTypeString))); 729 732 Assert.Fail("Exception expected"); 730 } catch (PersistenceException x) { 733 } 734 catch (PersistenceException x) { 731 735 Assert.IsTrue(x.Message.Contains("incompatible")); 732 736 } … … 737 741 d = new Deserializer(XmlParser.ParseTypeCache(new StringReader(newTypeString))); 738 742 Assert.Fail("Exception expected"); 739 } catch (PersistenceException x) { 743 } 744 catch (PersistenceException x) { 740 745 Assert.IsTrue(x.Message.Contains("newer")); 741 746 } … … 922 927 ExplodingDefaultConstructor newX = (ExplodingDefaultConstructor)XmlParser.Deserialize(tempFile); 923 928 Assert.Fail("Exception expected"); 924 } catch (PersistenceException pe) { 929 } 930 catch (PersistenceException pe) { 925 931 Assert.AreEqual(pe.InnerException.Message, "this constructor will always fail"); 926 932 } … … 935 941 XmlGenerator.Serialize(ns, tempFile); 936 942 Assert.Fail("PersistenceException expected"); 937 } catch (PersistenceException x) { 943 } 944 catch (PersistenceException x) { 938 945 Assert.IsTrue(x.Message.Contains(new StorableSerializer().JustifyRejection(typeof(NonSerializable)))); 939 946 } … … 987 994 } 988 995 989 [StorableClass(StorableClassType.AllFields )]996 [StorableClass(StorableClassType.AllFields, "B9AB42E8-1932-425B-B4CF-F31F07EAC599")] 990 997 public class AllFieldsStorable { 991 998 public int Value1 = 1; … … 1018 1025 } 1019 1026 1020 [StorableClass(StorableClassType.AllProperties )]1027 [StorableClass(StorableClassType.AllProperties, "CB7DC31C-AEF3-4EB8-91CA-248B767E9F92")] 1021 1028 public class AllPropertiesStorable { 1022 1029 public int Value1 = 1; … … 1050 1057 } 1051 1058 1052 [StorableClass(StorableClassType.AllFieldsAndAllProperties )]1059 [StorableClass(StorableClassType.AllFieldsAndAllProperties, "0AD8D68F-E0FF-4FA8-8A72-1148CD91A2B9")] 1053 1060 public class AllFieldsAndAllPropertiesStorable { 1054 1061 public int Value1 = 1; … … 1081 1088 } 1082 1089 1083 [StorableClass(StorableClassType.MarkedOnly )]1090 [StorableClass(StorableClassType.MarkedOnly, "0D94E6D4-64E3-4637-B1EE-DEF2B3F6E2E0")] 1084 1091 public class MarkedOnlyStorable { 1085 1092 public int Value1 = 1; … … 1256 1263 XmlGenerator.Serialize(new ReadOnlyFail(), tempFile); 1257 1264 Assert.Fail("Exception expected"); 1258 } catch (PersistenceException) { 1259 } catch { 1265 } 1266 catch (PersistenceException) { 1267 } 1268 catch { 1260 1269 Assert.Fail("PersistenceException expected"); 1261 1270 } … … 1278 1287 XmlGenerator.Serialize(new WriteOnlyFail(), tempFile); 1279 1288 Assert.Fail("Exception expected"); 1280 } catch (PersistenceException) { 1281 } catch { 1289 } 1290 catch (PersistenceException) { 1291 } 1292 catch { 1282 1293 Assert.Fail("PersistenceException expected."); 1283 1294 } … … 1461 1472 b[2] = byte.MaxValue; 1462 1473 XmlGenerator.Serialize(b, tempFile); 1463 var newB = (byte[]) 1474 var newB = (byte[])XmlParser.Deserialize(tempFile); 1464 1475 CollectionAssert.AreEqual(b, newB); 1465 1476 } … … 1469 1480 [TestProperty("Time", "short")] 1470 1481 public void TestOptionalNumberEnumerable() { 1471 var values = new List<double?> { 0, null, double.NaN, double.PositiveInfinity, double.MaxValue, 1};1482 var values = new List<double?> { 0, null, double.NaN, double.PositiveInfinity, double.MaxValue, 1 }; 1472 1483 XmlGenerator.Serialize(values, tempFile); 1473 var newValues = (List<double?>) 1484 var newValues = (List<double?>)XmlParser.Deserialize(tempFile); 1474 1485 CollectionAssert.AreEqual(values, newValues); 1475 1486 } … … 1482 1493 DateTime.ParseExact("10.09.2014 12:21", "dd.MM.yyyy hh:mm", CultureInfo.InvariantCulture), DateTime.MaxValue}; 1483 1494 XmlGenerator.Serialize(values, tempFile); 1484 var newValues = (List<DateTime?>) 1495 var newValues = (List<DateTime?>)XmlParser.Deserialize(tempFile); 1485 1496 CollectionAssert.AreEqual(values, newValues); 1486 1497 } … … 1490 1501 [TestProperty("Time", "short")] 1491 1502 public void TestStringEnumerable() { 1492 var values = new List<string> { "", null, "s", "string", string.Empty, "123", "<![CDATA[nice]]>", "<![CDATA[nasty unterminated"};1503 var values = new List<string> { "", null, "s", "string", string.Empty, "123", "<![CDATA[nice]]>", "<![CDATA[nasty unterminated" }; 1493 1504 XmlGenerator.Serialize(values, tempFile); 1494 var newValues = (List<String>) 1505 var newValues = (List<String>)XmlParser.Deserialize(tempFile); 1495 1506 CollectionAssert.AreEqual(values, newValues); 1496 1507 } … … 1500 1511 [TestProperty("Time", "short")] 1501 1512 public void TestUnicodeCharArray() { 1502 var s = Encoding.UTF8.GetChars(new byte[] { 0, 1, 2, 03, 04, 05, 06, 07, 08, 09, 0xa, 0xb});1513 var s = Encoding.UTF8.GetChars(new byte[] { 0, 1, 2, 03, 04, 05, 06, 07, 08, 09, 0xa, 0xb }); 1503 1514 XmlGenerator.Serialize(s, tempFile); 1504 1515 var newS = (char[])XmlParser.Deserialize(tempFile); … … 1510 1521 [TestProperty("Time", "short")] 1511 1522 public void TestUnicode() { 1512 var s = Encoding.UTF8.GetString(new byte[] { 0, 1, 2, 03, 04, 05, 06, 07, 08, 09, 0xa, 0xb});1523 var s = Encoding.UTF8.GetString(new byte[] { 0, 1, 2, 03, 04, 05, 06, 07, 08, 09, 0xa, 0xb }); 1513 1524 XmlGenerator.Serialize(s, tempFile); 1514 1525 var newS = XmlParser.Deserialize(tempFile); … … 1520 1531 [TestProperty("Time", "short")] 1521 1532 public void TestQueue() { 1522 var q = new Queue<int>(new[] { 1, 2, 3, 4, 0});1533 var q = new Queue<int>(new[] { 1, 2, 3, 4, 0 }); 1523 1534 XmlGenerator.Serialize(q, tempFile); 1524 1535 var newQ = (Queue<int>)XmlParser.Deserialize(tempFile);
Note: See TracChangeset
for help on using the changeset viewer.