Exemplo n.º 1
0
        public void RoundtripRestrictions(FileFormatVersions fileFormat)
        {
            byte[] Roundtrip()
            {
                var restrictions = SdbSchemaData.GetSchemaData(fileFormat).Restrictions;

                using (var ms = new MemoryStream())
                {
                    restrictions.Serialize(ms);
                    return(ms.ToArray());
                }
            }

            byte[] GetStream()
            {
                using (var stream = SdbSchemaData.GetStream(fileFormat, SdbSchemaData.SimpleTypes))
                    using (var ms = new MemoryStream())
                    {
                        stream.CopyTo(ms);
                        return(ms.ToArray());
                    }
            }

            var expected = GetNormalizedString(GetStream());
            var actual   = GetNormalizedString(Roundtrip());

            Assert.Equal(expected, actual);
        }