public void TestConfirmationAutoDetectionAllTypes()
 {
     foreach (var concreteType in FpMLViewHelpers.GetFpMLTypes(true))
     {
         System.Diagnostics.Debug.Print("Type: {0} ...", concreteType.Name);
         var orig = Activator.CreateInstance(concreteType);
         // serialise/deserialise as Document and then specific type
         foreach (var serialiserType in new[] {
             typeof(Document),
             concreteType,
         })
         {
             byte[] streamBytes;
             {
                 var xs = new XmlSerializer(serialiserType);
                 using (var ms = new MemoryStream())
                     using (var xw = new XmlTextWriter(ms, Encoding.UTF8))
                     {
                         xs.Serialize(xw, orig);
                         streamBytes = ms.ToArray();
                     }
                 using (var ms = new MemoryStream(streamBytes, false))
                 {
                     var copy = xs.Deserialize(ms);
                     Assert.IsNotNull(copy);
                     Assert.AreEqual(concreteType, copy.GetType());
                 }
             }
             // autodetect concrete type to deserialise from stream
             Type autoDetectedType = FpMLViewHelpers.AutoDetectType(streamBytes);
             using (var ms = new MemoryStream(streamBytes, false))
             {
                 var xs   = new XmlSerializer(autoDetectedType);
                 var copy = xs.Deserialize(ms);
                 Assert.IsNotNull(copy);
                 Assert.AreEqual(concreteType, copy.GetType());
             }
         }
     }
 }