Esempio n. 1
0
        public void Test()
        {
            var factroy       = new AnimatedCursorFactroy();
            var memoryContent = new MemoryContent();
            var defaultCursor = new AnimatedCursor(defaultConfig, defaultTextures);

            using (memoryContent.BeginUpdateAuto())
            {
                factroy.Write(memoryContent, defaultCursor);
            }

            var cursor2 = factroy.Read(memoryContent);

            Assert.AreEqual(defaultConfig, cursor2.Config);
            AreEqual(defaultTextures, cursor2.Textures);
        }
        public void Test()
        {
            var factroy       = new StaticCursorFactroy();
            var memoryContent = new MemoryContent();
            var defaultCursor = new StaticCursor(defaultTexture, defaultConfig);

            using (memoryContent.BeginUpdateAuto())
            {
                factroy.Write(memoryContent, defaultCursor);
            }

            var cursor2 = factroy.Read(memoryContent);

            Assert.AreEqual(defaultConfig, cursor2.Config);
            Assert.AreEqual(defaultTexture.width, cursor2.Texture.width);
            Assert.AreEqual(defaultTexture.height, cursor2.Texture.height);
        }
Esempio n. 3
0
        public void ReadWriteTest()
        {
            BindingSerializer <File> serializer = new BindingSerializer <File>();
            MemoryContent            content    = new MemoryContent();
            var file = DefalutFile;

            using (content.BeginUpdateAuto())
            {
                serializer.Serialize(content, ref file);
            }

            Assert.True(content.Contains(nameof(File.XmlTest)));
            Assert.True(content.Contains(nameof(File.ProtoTest)));
            Assert.IsFalse(content.Contains(nameof(File.IgnoreField)));

            var value = serializer.Deserialize(content) as File;

            Assert.AreEqual(file, value);
        }