Example #1
0
        public void キャッシュ無しリフレクションによるシリアライズ()
        {
            var serializer = new StringSerializerWithReflection();

            var stopwatch = new Stopwatch();

            stopwatch.Start();
            for (var i = 0; i < Setting.PerformanceTestTrialCount; i++)
            {
                serializer.Serialize(Helper.TestObject);
            }
            stopwatch.Stop();

            Helper.PrintResult(stopwatch);
        }
Example #2
0
        public void キャッシュ無しリフレクション正しくシリアライズできる()
        {
            var serializableObject = new SimpleSerializableObject()
            {
                Int1    = 1,
                Int2    = 2,
                Int3    = 3,
                String1 = "abc",
                String2 = "def",
                String3 = "ghi",
            };

            var serializer = new StringSerializerWithReflection();

            Assert.AreEqual(
                "Int1\t1\n" + "Int2\t2\n" + "Int3\t3\n" + "String1\tabc\n" + "String2\tdef\n" + "String3\tghi\n",
                serializer.Serialize(serializableObject));
        }