示例#1
0
        public void VerifyAssemblyNameExSerializationByTranslator(string assemblyName)
        {
            AssemblyNameExtension assemblyNameOriginal     = new AssemblyNameExtension(assemblyName);
            AssemblyNameExtension assemblyNameDeserialized = null;

            MemoryStream serializationStream = new MemoryStream();
            ITranslator  writeTranslator     = BinaryTranslator.GetWriteTranslator(serializationStream);

            writeTranslator.Translate(ref assemblyNameOriginal, (ITranslator t) => new AssemblyNameExtension(t));

            serializationStream.Seek(0, SeekOrigin.Begin);
            ITranslator readTranslator = BinaryTranslator.GetReadTranslator(serializationStream, null);

            readTranslator.Translate(ref assemblyNameDeserialized, (ITranslator t) => new AssemblyNameExtension(t));

            assemblyNameDeserialized.ShouldBe(assemblyNameOriginal);
        }