Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/24/15 17:10:41 (9 years ago)
Author:
ascheibe
Message:

#2520 fixed unit tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PersistenceOverhaul/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/UseCases.cs

    r13368 r13370  
    639639        XmlGenerator.Serialize(c, tempFile);
    640640        Assert.Fail("Exception not thrown");
    641       } catch (PersistenceException) {
     641      }
     642      catch (PersistenceException) {
    642643      }
    643644    }
     
    653654        XmlGenerator.Serialize(s, tempFile);
    654655        Assert.Fail("Exception expected");
    655       } catch (PersistenceException) { }
     656      }
     657      catch (PersistenceException) { }
    656658      List<int> newList = (List<int>)XmlParser.Deserialize(tempFile);
    657659      Assert.AreEqual(list[0], newList[0]);
     
    698700        }
    699701        Assert.Fail("Exception expected");
    700       } catch (PersistenceException px) {
     702      }
     703      catch (PersistenceException px) {
    701704        Assert.AreEqual(3, px.Data.Count);
    702705      }
     
    728731        d = new Deserializer(XmlParser.ParseTypeCache(new StringReader(newTypeString)));
    729732        Assert.Fail("Exception expected");
    730       } catch (PersistenceException x) {
     733      }
     734      catch (PersistenceException x) {
    731735        Assert.IsTrue(x.Message.Contains("incompatible"));
    732736      }
     
    737741        d = new Deserializer(XmlParser.ParseTypeCache(new StringReader(newTypeString)));
    738742        Assert.Fail("Exception expected");
    739       } catch (PersistenceException x) {
     743      }
     744      catch (PersistenceException x) {
    740745        Assert.IsTrue(x.Message.Contains("newer"));
    741746      }
     
    922927        ExplodingDefaultConstructor newX = (ExplodingDefaultConstructor)XmlParser.Deserialize(tempFile);
    923928        Assert.Fail("Exception expected");
    924       } catch (PersistenceException pe) {
     929      }
     930      catch (PersistenceException pe) {
    925931        Assert.AreEqual(pe.InnerException.Message, "this constructor will always fail");
    926932      }
     
    935941        XmlGenerator.Serialize(ns, tempFile);
    936942        Assert.Fail("PersistenceException expected");
    937       } catch (PersistenceException x) {
     943      }
     944      catch (PersistenceException x) {
    938945        Assert.IsTrue(x.Message.Contains(new StorableSerializer().JustifyRejection(typeof(NonSerializable))));
    939946      }
     
    987994    }
    988995
    989     [StorableClass(StorableClassType.AllFields)]
     996    [StorableClass(StorableClassType.AllFields, "B9AB42E8-1932-425B-B4CF-F31F07EAC599")]
    990997    public class AllFieldsStorable {
    991998      public int Value1 = 1;
     
    10181025    }
    10191026
    1020     [StorableClass(StorableClassType.AllProperties)]
     1027    [StorableClass(StorableClassType.AllProperties, "CB7DC31C-AEF3-4EB8-91CA-248B767E9F92")]
    10211028    public class AllPropertiesStorable {
    10221029      public int Value1 = 1;
     
    10501057    }
    10511058
    1052     [StorableClass(StorableClassType.AllFieldsAndAllProperties)]
     1059    [StorableClass(StorableClassType.AllFieldsAndAllProperties, "0AD8D68F-E0FF-4FA8-8A72-1148CD91A2B9")]
    10531060    public class AllFieldsAndAllPropertiesStorable {
    10541061      public int Value1 = 1;
     
    10811088    }
    10821089
    1083     [StorableClass(StorableClassType.MarkedOnly)]
     1090    [StorableClass(StorableClassType.MarkedOnly, "0D94E6D4-64E3-4637-B1EE-DEF2B3F6E2E0")]
    10841091    public class MarkedOnlyStorable {
    10851092      public int Value1 = 1;
     
    12561263        XmlGenerator.Serialize(new ReadOnlyFail(), tempFile);
    12571264        Assert.Fail("Exception expected");
    1258       } catch (PersistenceException) {
    1259       } catch {
     1265      }
     1266      catch (PersistenceException) {
     1267      }
     1268      catch {
    12601269        Assert.Fail("PersistenceException expected");
    12611270      }
     
    12781287        XmlGenerator.Serialize(new WriteOnlyFail(), tempFile);
    12791288        Assert.Fail("Exception expected");
    1280       } catch (PersistenceException) {
    1281       } catch {
     1289      }
     1290      catch (PersistenceException) {
     1291      }
     1292      catch {
    12821293        Assert.Fail("PersistenceException expected.");
    12831294      }
     
    14611472      b[2] = byte.MaxValue;
    14621473      XmlGenerator.Serialize(b, tempFile);
    1463       var newB = (byte[]) XmlParser.Deserialize(tempFile);
     1474      var newB = (byte[])XmlParser.Deserialize(tempFile);
    14641475      CollectionAssert.AreEqual(b, newB);
    14651476    }
     
    14691480    [TestProperty("Time", "short")]
    14701481    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 };
    14721483      XmlGenerator.Serialize(values, tempFile);
    1473       var newValues = (List<double?>) XmlParser.Deserialize(tempFile);
     1484      var newValues = (List<double?>)XmlParser.Deserialize(tempFile);
    14741485      CollectionAssert.AreEqual(values, newValues);
    14751486    }
     
    14821493        DateTime.ParseExact("10.09.2014 12:21", "dd.MM.yyyy hh:mm", CultureInfo.InvariantCulture), DateTime.MaxValue};
    14831494      XmlGenerator.Serialize(values, tempFile);
    1484       var newValues = (List<DateTime?>) XmlParser.Deserialize(tempFile);
     1495      var newValues = (List<DateTime?>)XmlParser.Deserialize(tempFile);
    14851496      CollectionAssert.AreEqual(values, newValues);
    14861497    }
     
    14901501    [TestProperty("Time", "short")]
    14911502    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" };
    14931504      XmlGenerator.Serialize(values, tempFile);
    1494       var newValues = (List<String>) XmlParser.Deserialize(tempFile);
     1505      var newValues = (List<String>)XmlParser.Deserialize(tempFile);
    14951506      CollectionAssert.AreEqual(values, newValues);
    14961507    }
     
    15001511    [TestProperty("Time", "short")]
    15011512    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 });
    15031514      XmlGenerator.Serialize(s, tempFile);
    15041515      var newS = (char[])XmlParser.Deserialize(tempFile);
     
    15101521    [TestProperty("Time", "short")]
    15111522    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 });
    15131524      XmlGenerator.Serialize(s, tempFile);
    15141525      var newS = XmlParser.Deserialize(tempFile);
     
    15201531    [TestProperty("Time", "short")]
    15211532    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 });
    15231534      XmlGenerator.Serialize(q, tempFile);
    15241535      var newQ = (Queue<int>)XmlParser.Deserialize(tempFile);
Note: See TracChangeset for help on using the changeset viewer.