public async Task ClassWithPrimitives()
        {
            var point = new Parameterized_ClassWithPrimitives_3Args(x: 234235, y: 912874, z: 434934);

            point.FirstInt       = 348943;
            point.SecondInt      = 348943;
            point.FirstString    = "934sdkjfskdfssf";
            point.SecondString   = "sdad9434243242";
            point.FirstDateTime  = DateTime.Now;
            point.SecondDateTime = DateTime.Now.AddHours(1).AddYears(1);

            point.ThirdInt       = 348943;
            point.FourthInt      = 348943;
            point.ThirdString    = "934sdkjfskdfssf";
            point.FourthString   = "sdad9434243242";
            point.ThirdDateTime  = DateTime.Now;
            point.FourthDateTime = DateTime.Now.AddHours(1).AddYears(1);

            string json = JsonSerializer.Serialize(point);

            var deserialized = await Serializer.DeserializeWrapper <Parameterized_ClassWithPrimitives_3Args>(json);

            Assert.Equal(point.FirstInt, deserialized.FirstInt);
            Assert.Equal(point.SecondInt, deserialized.SecondInt);
            Assert.Equal(point.FirstString, deserialized.FirstString);
            Assert.Equal(point.SecondString, deserialized.SecondString);
            Assert.Equal(point.FirstDateTime, deserialized.FirstDateTime);
            Assert.Equal(point.SecondDateTime, deserialized.SecondDateTime);

            Assert.Equal(point.X, deserialized.X);
            Assert.Equal(point.Y, deserialized.Y);
            Assert.Equal(point.Z, deserialized.Z);

            Assert.Equal(point.ThirdInt, deserialized.ThirdInt);
            Assert.Equal(point.FourthInt, deserialized.FourthInt);
            Assert.Equal(point.ThirdString, deserialized.ThirdString);
            Assert.Equal(point.FourthString, deserialized.FourthString);
            Assert.Equal(point.ThirdDateTime, deserialized.ThirdDateTime);
            Assert.Equal(point.FourthDateTime, deserialized.FourthDateTime);
        }
예제 #2
0
        public void ClassWithPrimitivesPerf()
        {
            var point = new Parameterized_ClassWithPrimitives_3Args(x: 234235, y: 912874, z: 434934);

            point.FirstInt       = 348943;
            point.SecondInt      = 348943;
            point.FirstString    = "934sdkjfskdfssf";
            point.SecondString   = "sdad9434243242";
            point.FirstDateTime  = DateTime.Now;
            point.SecondDateTime = DateTime.Now.AddHours(1).AddYears(1);

            point.ThirdInt       = 348943;
            point.FourthInt      = 348943;
            point.ThirdString    = "934sdkjfskdfssf";
            point.FourthString   = "sdad9434243242";
            point.ThirdDateTime  = DateTime.Now;
            point.FourthDateTime = DateTime.Now.AddHours(1).AddYears(1);

            string json = JsonSerializer.Serialize(point);

            Serializer.Deserialize <Parameterized_ClassWithPrimitives_3Args>(json);
            Serializer.Deserialize <Parameterized_ClassWithPrimitives_3Args>(json);
        }