Index: branches/PersistenceOverhaul/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/UseCasesPersistenceNew.cs
===================================================================
--- branches/PersistenceOverhaul/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/UseCasesPersistenceNew.cs	(revision 13410)
+++ branches/PersistenceOverhaul/HeuristicLab.Tests/HeuristicLab.Persistence-3.3/UseCasesPersistenceNew.cs	(revision 14537)
@@ -273,6 +273,9 @@
   }
 
+  [StorableClass("FD953B0A-BDE6-41E6-91A8-CA3D90C91CDB")]
   public class SimpleClass {
+    [Storable]
     public double x { get; set; }
+    [Storable]
     public int y { get; set; }
   }
@@ -653,4 +656,68 @@
     [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
+    public void TestSBytes() {
+      var test = new Func<sbyte[]>(() => { return new sbyte[] { 3, 1 }; });
+      ProtoBufSerializer serializer = new ProtoBufSerializer();
+      serializer.Serialize(test(), tempFile);
+      object o = serializer.Deserialize(tempFile);
+      sbyte[] result = (sbyte[])o;
+      Assert.AreEqual(test()[0], result[0]);
+      Assert.AreEqual(test()[1], result[1]);
+
+      string msg = Profile(test);
+      Console.WriteLine(msg);
+    }
+
+    [TestMethod]
+    [TestCategory("Persistence4")]
+    [TestProperty("Time", "short")]
+    public void TestChars() {
+      var test = new Func<char[]>(() => { return new char[] { 'a', 'b' }; });
+      ProtoBufSerializer serializer = new ProtoBufSerializer();
+      serializer.Serialize(test(), tempFile);
+      object o = serializer.Deserialize(tempFile);
+      char[] result = (char[])o;
+      Assert.AreEqual(test()[0], result[0]);
+      Assert.AreEqual(test()[1], result[1]);
+
+      string msg = Profile(test);
+      Console.WriteLine(msg);
+    }
+
+    [TestMethod]
+    [TestCategory("Persistence4")]
+    [TestProperty("Time", "short")]
+    public void TestShorts() {
+      var test = new Func<short[]>(() => { return new short[] { 3, 1 }; });
+      ProtoBufSerializer serializer = new ProtoBufSerializer();
+      serializer.Serialize(test(), tempFile);
+      object o = serializer.Deserialize(tempFile);
+      short[] result = (short[])o;
+      Assert.AreEqual(test()[0], result[0]);
+      Assert.AreEqual(test()[1], result[1]);
+
+      string msg = Profile(test);
+      Console.WriteLine(msg);
+    }
+
+    [TestMethod]
+    [TestCategory("Persistence4")]
+    [TestProperty("Time", "short")]
+    public void TestUShorts() {
+      var test = new Func<ushort[]>(() => { return new ushort[] { 3, 1 }; });
+      ProtoBufSerializer serializer = new ProtoBufSerializer();
+      serializer.Serialize(test(), tempFile);
+      object o = serializer.Deserialize(tempFile);
+      ushort[] result = (ushort[])o;
+      Assert.AreEqual(test()[0], result[0]);
+      Assert.AreEqual(test()[1], result[1]);
+
+      string msg = Profile(test);
+      Console.WriteLine(msg);
+    }
+
+    [TestMethod]
+    [TestCategory("Persistence4")]
+    [TestProperty("Time", "short")]
     public void TestString() {
       var test = new Func<object>(() => { return "Hello World!"; });
@@ -669,5 +736,5 @@
     [TestProperty("Time", "short")]
     public void TestColor() {
-      var test = new Func<object>(() => { return Color.DeepSkyBlue; });
+      var test = new Func<object>(() => { return Color.FromArgb(12, 34, 56, 78); });
       ProtoBufSerializer serializer = new ProtoBufSerializer();
       serializer.Serialize(test(), tempFile);
@@ -791,4 +858,56 @@
     [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
+    public void TestStack() {
+      var test = new Func<Stack>(() => {
+        return new Stack(new int[] { 1, 2, 3 });
+      });
+      ProtoBufSerializer serializer = new ProtoBufSerializer();
+      serializer.Serialize(test(), tempFile);
+      object o = serializer.Deserialize(tempFile);
+      Stack result = (Stack)o;
+      var actualStack = test();
+      Assert.AreEqual(actualStack.Pop(), result.Pop());
+      Assert.AreEqual(actualStack.Pop(), result.Pop());
+      Assert.AreEqual(actualStack.Pop(), result.Pop());
+
+      string msg = Profile(test);
+      Console.WriteLine(msg);
+    }
+
+    [TestMethod]
+    [TestCategory("Persistence4")]
+    [TestProperty("Time", "short")]
+    public void TestArrayOfStack() {
+      var test = new Func<object[]>(() => {
+        return new object[] {
+          new Stack(new int[] { 1, 2, 3 }),
+          new Stack<int>(new int[] { 1, 2, 3 }),
+      };
+      });
+      ProtoBufSerializer serializer = new ProtoBufSerializer();
+      serializer.Serialize(test(), tempFile);
+      object o = serializer.Deserialize(tempFile);
+      var result = (object[])o;
+      var firstStack = (Stack)result[0];
+      var secondStack = (Stack<int>)result[1];
+      var actual = test();
+      var actualFirst = (Stack)actual[0];
+      var actualSecond = (Stack<int>)actual[1];
+
+      Assert.AreEqual(actualFirst.Pop(), firstStack.Pop());
+      Assert.AreEqual(actualFirst.Pop(), firstStack.Pop());
+      Assert.AreEqual(actualFirst.Pop(), firstStack.Pop());
+      Assert.AreEqual(actualSecond.Pop(), secondStack.Pop());
+      Assert.AreEqual(actualSecond.Pop(), secondStack.Pop());
+      Assert.AreEqual(actualSecond.Pop(), secondStack.Pop());
+
+      string msg = Profile(test);
+      Console.WriteLine(msg);
+    }
+
+
+    [TestMethod]
+    [TestCategory("Persistence4")]
+    [TestProperty("Time", "short")]
     public void TestIntValueArray() {
       var test = new Func<IntValue[]>(() => { return new[] { new IntValue(41), new IntValue(22), new IntValue(13) }; });
@@ -797,7 +916,24 @@
       object o = serializer.Deserialize(tempFile);
       IntValue[] result = (IntValue[])o;
-      Assert.AreEqual(test()[0], result[0]);
-      Assert.AreEqual(test()[1], result[1]);
-      Assert.AreEqual(test()[2], result[2]);
+      Assert.AreEqual(test()[0].Value, result[0].Value);
+      Assert.AreEqual(test()[1].Value, result[1].Value);
+      Assert.AreEqual(test()[2].Value, result[2].Value);
+
+      string msg = Profile(test);
+      Console.WriteLine(msg);
+    }
+
+    [TestMethod]
+    [TestCategory("Persistence4")]
+    [TestProperty("Time", "short")]
+    public void TestIntValueArrayArray() {
+      var test = new Func<IntValue[][]>(() => { return new IntValue[][] { new IntValue[] { new IntValue(41), new IntValue(22), new IntValue(13) } }; });
+      ProtoBufSerializer serializer = new ProtoBufSerializer();
+      serializer.Serialize(test(), tempFile);
+      object o = serializer.Deserialize(tempFile);
+      IntValue[][] result = (IntValue[][])o;
+      Assert.AreEqual(test()[0][0].Value, result[0][0].Value);
+      Assert.AreEqual(test()[0][1].Value, result[0][1].Value);
+      Assert.AreEqual(test()[0][2].Value, result[0][2].Value);
 
       string msg = Profile(test);
@@ -809,5 +945,5 @@
     #region Old persistence test methods
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void ComplexStorable() {
@@ -899,5 +1035,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void SelfReferences() {
@@ -927,5 +1063,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void ArrayCreation() {
@@ -957,5 +1093,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void CustomSerializationProperty() {
@@ -974,5 +1110,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void Primitives() {
@@ -987,5 +1123,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void MultiDimensionalArray() {
@@ -1018,5 +1154,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void NestedTypeTest() {
@@ -1033,5 +1169,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void SimpleArray() {
@@ -1046,5 +1182,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void PrimitiveRoot() {
@@ -1101,5 +1237,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void Enums() {
@@ -1117,5 +1253,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestAliasingWithOverriddenEquals() {
@@ -1135,5 +1271,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void NonDefaultConstructorTest() {
@@ -1143,11 +1279,10 @@
         serializer.Serialize(c, tempFile);
         Assert.Fail("Exception not thrown");
-      }
-      catch (PersistenceException) {
-      }
-    }
-
-    [TestMethod]
-    [TestCategory("Persistence")]
+      } catch (PersistenceException) {
+      }
+    }
+
+    [TestMethod]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestSavingException() {
@@ -1159,6 +1294,5 @@
         serializer.Serialize(s, tempFile);
         Assert.Fail("Exception expected");
-      }
-      catch (PersistenceException) { }
+      } catch (PersistenceException) { }
       List<int> newList = (List<int>)serializer.Deserialize(tempFile);
       Assert.AreEqual(list[0], newList[0]);
@@ -1167,5 +1301,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestTypeStringConversion() {
@@ -1179,5 +1313,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestHexadecimalPublicKeyToken() {
@@ -1189,5 +1323,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void InheritanceTest() {
@@ -1219,5 +1353,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void InstantiateParentChainReference() {
@@ -1244,5 +1378,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void StructTest() {
@@ -1255,5 +1389,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void PointTest() {
@@ -1266,5 +1400,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void NullableValueTypes() {
@@ -1280,5 +1414,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void BitmapTest() {
@@ -1314,5 +1448,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void HookTest() {
@@ -1347,5 +1481,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestCustomConstructor() {
@@ -1368,5 +1502,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestConstructorExceptionUnwrapping() {
@@ -1377,6 +1511,5 @@
         ExplodingDefaultConstructor newX = (ExplodingDefaultConstructor)serializer.Deserialize(tempFile);
         Assert.Fail("Exception expected");
-      }
-      catch (PersistenceException pe) {
+      } catch (PersistenceException pe) {
         Assert.AreEqual(pe.InnerException.Message, "this constructor will always fail");
       }
@@ -1384,20 +1517,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
-    [TestProperty("Time", "short")]
-    public void TestRejectionJustifications() {
-      ProtoBufSerializer serializer = new ProtoBufSerializer();
-      NonSerializable ns = new NonSerializable();
-      try {
-        serializer.Serialize(ns, tempFile);
-        Assert.Fail("PersistenceException expected");
-      }
-      catch (PersistenceException x) {
-        Assert.IsTrue(x.Message.Contains(new StorableSerializer().JustifyRejection(typeof(NonSerializable))));
-      }
-    }
-
-    [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestStreaming() {
@@ -1436,5 +1554,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestLinkInheritance() {
@@ -1466,5 +1584,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestStorableClassDiscoveryAllFields() {
@@ -1498,5 +1616,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestStorableClassDiscoveryAllProperties() {
@@ -1531,5 +1649,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestStorableClassDiscoveryAllFieldsAndAllProperties() {
@@ -1563,5 +1681,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestStorableClassDiscoveryMarkedOnly() {
@@ -1577,5 +1695,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestLineEndings() {
@@ -1594,5 +1712,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestSpecialNumbers() {
@@ -1610,5 +1728,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestStringSplit() {
@@ -1633,5 +1751,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestHashSetSerializer() {
@@ -1654,5 +1772,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestConcreteDictionarySerializer() {
@@ -1695,5 +1813,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestReadOnlyFail() {
@@ -1702,8 +1820,6 @@
         serializer.Serialize(new ReadOnlyFail(), tempFile);
         Assert.Fail("Exception expected");
-      }
-      catch (PersistenceException) {
-      }
-      catch {
+      } catch (PersistenceException) {
+      } catch {
         Assert.Fail("PersistenceException expected");
       }
@@ -1720,5 +1836,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestWriteOnlyFail() {
@@ -1727,8 +1843,6 @@
         serializer.Serialize(new WriteOnlyFail(), tempFile);
         Assert.Fail("Exception expected");
-      }
-      catch (PersistenceException) {
-      }
-      catch {
+      } catch (PersistenceException) {
+      } catch {
         Assert.Fail("PersistenceException expected.");
       }
@@ -1751,5 +1865,5 @@
     //TODO
     /* [TestMethod]
-     [TestCategory("Persistence")]
+     [TestCategory("Persistence4")]
      [TestProperty("Time", "short")]
      public void TestTypeCacheExport() {
@@ -1769,5 +1883,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TupleTest() {
@@ -1777,11 +1891,11 @@
       var t4 = Tuple.Create(Tuple.Create(1, 2, 3), Tuple.Create(4, 5, 6), Tuple.Create(8, 9, 10));
       var tuple = Tuple.Create(t1, t2, t3, t4);
-      XmlGenerator.Serialize(tuple, tempFile);
-      var newTuple = XmlParser.Deserialize<Tuple<Tuple<int>, Tuple<char, string>, Tuple<double, float, int>, Tuple<Tuple<int, int, int>, Tuple<int, int, int>, Tuple<int, int, int>>>>(tempFile);
+      SerializeNew(tuple);
+      var newTuple = DeserializeNew();
       Assert.AreEqual(tuple, newTuple);
     }
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void FontTest() {
@@ -1802,5 +1916,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "medium")]
     public void ConcurrencyTest() {
@@ -1821,5 +1935,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "medium")]
     public void ConcurrentBitmapTest() {
@@ -1852,5 +1966,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestSpecialCharacters() {
@@ -1863,5 +1977,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestByteArray() {
@@ -1877,5 +1991,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestOptionalNumberEnumerable() {
@@ -1888,5 +2002,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestOptionalDateTimeEnumerable() {
@@ -1900,5 +2014,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestStringEnumerable() {
@@ -1911,5 +2025,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestUnicodeCharArray() {
@@ -1922,5 +2036,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestUnicode() {
@@ -1933,5 +2047,5 @@
 
     [TestMethod]
-    [TestCategory("Persistence")]
+    [TestCategory("Persistence4")]
     [TestProperty("Time", "short")]
     public void TestQueue() {
