Ejemplo n.º 1
0
 public static void TestCase8()
 {
     TestBaseConfig.Seed = 1;
     MixClass a = ShiboSerializer.Initialize <MixClass>(TestBaseConfig.Seed);
     //a.V8 = "sdfdfg";
     //a.V5.V3 = 1;
     MixClass b = ShiboSerializer.Initialize <MixClass>(TestBaseConfig.Seed);
     //b.V8 = "sdfdfg";
     //Assert.AreEqual(
     //Console.WriteLine(ShiboComparer.Compare(a, b));
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 对象数据初始化测试
        /// </summary>
        public static void TestCase7()
        {
            TestBaseConfig.Seed = 1;
            MixClass  a = ShiboSerializer.Initialize <MixClass>();
            Stopwatch w = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                a = ShiboSerializer.Initialize <MixClass>();
            }
            w.Stop();
            Console.WriteLine(w.ElapsedMilliseconds);
            Console.WriteLine(JsonConvert.SerializeObject(a));
        }
Ejemplo n.º 3
0
        public static void TestCase4()
        {
            TestBaseConfig.Seed = 1;
            MixClass a = MixClass.Init();

            byte[]    buffer = ShiboSerializer.BinarySerialize(a);
            MixClass  b      = ShiboSerializer.BinaryDeserialize <MixClass>(buffer);
            Stopwatch w      = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                buffer = ShiboSerializer.BinarySerialize(a);
                //b = ShiboSerializer.BinDeserialize<MixClass>(buffer);
            }
            w.Stop();
            Console.WriteLine(w.ElapsedMilliseconds);
            Console.WriteLine(JsonConvert.SerializeObject(a) == JsonConvert.SerializeObject(b));
        }
Ejemplo n.º 4
0
        public static void TestCase4()
        {
            TestBaseConfig.Seed = 1;
            MixClass a    = MixClass.Init();
            string   json = ShiboSerializer.Serialize(a);
            MixClass b    = ShiboSerializer.Deserialize <MixClass>(json);

            //Test(a);

            Stopwatch w = Stopwatch.StartNew();

            for (int i = 0; i < 1000000; i++)
            {
                //JsonConvert.SerializeObject(a);
                //ShiboSerializer.Serialize(a);
                b = ShiboSerializer.Deserialize <MixClass>(json);
                //b = JsonConvert.DeserializeObject<MixClass>(json);
            }
            w.Stop();
            Console.WriteLine(w.ElapsedMilliseconds);
            Console.WriteLine(JsonConvert.SerializeObject(a) == JsonConvert.SerializeObject(b));
        }