Exemple #1
0
        public void Interface()
        {
            ITestInterface model1 = new TestInterfaceImplemented()
            {
                Property1 = 5,
                Property2 = 6,
                Property3 = 7
            };
            var json   = JsonSerializer.Serialize(model1);
            var model2 = JsonSerializer.Deserialize <ITestInterface>(json);

            Assert.AreEqual(5, model2.Property1);
            Assert.AreEqual(6, model2.Property2);
        }
Exemple #2
0
        public void Interface()
        {
            var            serializer = new ByteSerializer();
            ITestInterface model1     = new TestInterfaceImplemented()
            {
                Property1 = 5,
                Property2 = 6,
                Property3 = 7
            };
            var bytes  = serializer.Serialize(model1);
            var model2 = serializer.Deserialize <ITestInterface>(bytes);

            Assert.AreEqual(5, model2.Property1);
            Assert.AreEqual(6, model2.Property2);
        }