Ejemplo n.º 1
0
        public void TestDictionaryEncoding()
        {
            List <string> actualdictionary = null;

            using (var reader = new PackedXml.PackedXmlReader(encodedFile, originalFile))
            {
                reader.ReadHeader();
                actualdictionary = reader.ReadDictionary();

                var decoded = File.ReadAllText(decodedFile);

                XmlDocument xDoc = new XmlDocument();
                xDoc.LoadXml(decoded);
                var newDict = Reader.GetXmlDict(xDoc);

                Assert.IsTrue(newDict.SequenceEqual(actualdictionary));
            }
        }
Ejemplo n.º 2
0
        public void ReadDictionary()
        {
            List <string> expected = null;

            using (var fileStream = File.OpenRead(encodedFile))
                using (var binaryReader = new BinaryReader(fileStream))
                {
                    binaryReader.ReadInt32(); //header
                    binaryReader.ReadSByte(); //skip byte

                    var PS = new Packed_Section();

                    expected = PS.readDictionary(binaryReader);
                }
            using (var reader = new PackedXml.PackedXmlReader(encodedFile, originalFile))
            {
                reader.ReadHeader();
                var actual = reader.ReadDictionary();

                Assert.IsNotNull(actual);
                Assert.AreEqual(expected.Count, actual.Count);
                CollectionAssert.AreEqual(expected, actual);
            }
        }