public void Write__Verify_Header()
        {
            serializer = new TypeSerializer();

            IType typeToSerialize = MockRepository.GenerateStub<IType>();
            typeToSerialize.Expect(x => x.TypeId).Return(0x2);
            typeToSerialize.Expect(x => x.NumFields).Return(1);

            byte[] writtenData = serializer.Write("fieldName", typeToSerialize);
            byte[] expected = File.ReadAllBytes("Content/Tests/TypeSerializer/Type-Header.bin");
            Assert.AreEqual(BitConverter.ToString(expected), BitConverter.ToString(writtenData));
        }
        public void Read__Reading_A_Valid_Serialization()
        {
            byte[] serialized = File.ReadAllBytes("Content/Tests/TypeSerializer/Type-Header.bin");

            serializer = new TypeSerializer();
            ITypeFactory factory = MockRepository.GenerateMock<ITypeFactory>();
            factory.Expect(x => x.Create(0x2, 1)).Return(MockRepository.GenerateStub<IType>());
            serializer.TypeFactory = factory;

            string fieldName;
            serializer.Read(serialized, out fieldName);

            Assert.AreEqual("fieldName", fieldName);
            factory.VerifyAllExpectations();
        }