Exemple #1
0
        private void TestRoundTrips(byte[] data)
        {
            SerializedAssets assets;

            using (Stream stream = new MemoryStream(data)) {
                assets = new SerializedAssets(stream);
            }
            byte[] outData;
            using (MemoryStream stream = new MemoryStream()) {
                assets.WriteTo(stream);
                stream.Close();
                outData = stream.ToArray();
            }
            Assert.True(System.Linq.Enumerable.SequenceEqual(data, outData));
        }
Exemple #2
0
        private void TestRoundTrips(byte[] data, string name)
        {
            SerializedAssets assets;

            File.WriteAllBytes($"../../../../testoutput/{name}.before.asset", data);
            using (Stream stream = new MemoryStream(data)) {
                assets = new SerializedAssets(stream);
            }
            byte[] outData;
            using (MemoryStream stream = new MemoryStream()) {
                assets.WriteTo(stream);
                stream.Close();
                outData = stream.ToArray();
            }
            File.WriteAllBytes($"../../../../testoutput/{name}.after.asset", outData);
            Assert.True(System.Linq.Enumerable.SequenceEqual(data, outData));
        }