Example #1
0
        public void WriteSwfFileInfoTest()
        {
            var fileInfo = new SwfFileInfo {
                Format     = SwfFormat.CWS,
                Version    = 10,
                FileLength = 0x12345678
            };
            var mem    = new MemoryStream();
            var writer = new SwfStreamWriter(mem);

            writer.WriteSwfFileInfo(fileInfo);

            mem.Seek(0, SeekOrigin.Begin);

            Assert.AreEqual((byte)'C', mem.ReadByte());
            Assert.AreEqual((byte)'W', mem.ReadByte());
            Assert.AreEqual((byte)'S', mem.ReadByte());

            Assert.AreEqual(10, mem.ReadByte());

            Assert.AreEqual(0x78, mem.ReadByte());
            Assert.AreEqual(0x56, mem.ReadByte());
            Assert.AreEqual(0x34, mem.ReadByte());
            Assert.AreEqual(0x12, mem.ReadByte());

            Assert.AreEqual(mem.Length, mem.Position, "Should reach end of the stream");
        }
        public void WriteSwfFileInfoTest()
        {
            var fileInfo = new SwfFileInfo {
                Format = "CWS",
                Version = 10,
                FileLength = 0x12345678
            };
            var mem = new MemoryStream();
            var writer = new SwfStreamWriter(mem);
            writer.WriteSwfFileInfo(fileInfo);

            mem.Seek(0, SeekOrigin.Begin);

            Assert.AreEqual((byte)'C', mem.ReadByte());
            Assert.AreEqual((byte)'W', mem.ReadByte());
            Assert.AreEqual((byte)'S', mem.ReadByte());

            Assert.AreEqual(10, mem.ReadByte());

            Assert.AreEqual(0x78, mem.ReadByte());
            Assert.AreEqual(0x56, mem.ReadByte());
            Assert.AreEqual(0x34, mem.ReadByte());
            Assert.AreEqual(0x12, mem.ReadByte());

            Assert.AreEqual(mem.Length, mem.Position, "Should reach end of the stream");
        }