Ejemplo n.º 1
0
        public void TestEmptyWzFileSerializes()
        {
            var file = new WzFile(1, WzMapleVersionType.Classic);

            using var ms = new MemoryStream();
            file.Serialize(ms);
            var contents     = Encoding.ASCII.GetString(ms.ToArray());
            var deserialized = WzObject.DeserializeFile(contents);

            Assert.IsNotNull(deserialized);
        }
Ejemplo n.º 2
0
        public void TestWzFileWithImageAndPropertySerializes()
        {
            var intProp = new WzIntProperty("int1", 100);
            var img     = new WzImage("test.img");
            var file    = new WzFile(1, WzMapleVersionType.Classic);

            img.AddProperty(intProp);
            file.WzDirectory.WzImages.Add(img);

            using var ms = new MemoryStream();
            file.Serialize(ms);
            var contents        = Encoding.ASCII.GetString(ms.ToArray());
            var deserialized    = WzObject.DeserializeFile(contents);
            var deserializedImg = deserialized.WzDirectory.GetImageByName(img.Name);

            Assert.IsNotNull(deserializedImg);
            Assert.AreEqual(intProp.Value, deserializedImg[intProp.Name].GetInt());
        }