Ejemplo n.º 1
0
        public void ClassAttributeTest()
        {
            Serializer       serializer = new Serializer();
            MyImmutablePoint expectedPt = new MyImmutablePoint(12, -10);
            string           result     = serializer.Serialize(expectedPt);
            MyImmutablePoint actualPt   = serializer.Deserialize <MyImmutablePoint>(result);

            Assert.AreEqual(expectedPt, actualPt, "MyImmutablePoint class not serialized correctly");
        }
Ejemplo n.º 2
0
        public void CtorParmsUsePropertyConverter()
        {
            MyImmutablePoint start  = new MyImmutablePoint(3, 10);
            MyImmutablePoint end    = new MyImmutablePoint(-5, -15);
            MyImmutableLine  line   = new MyImmutableLine(start, end);
            Serializer       s      = new Serializer();
            string           result = s.Serialize(line);
            MyImmutableLine  actual = s.Deserialize <MyImmutableLine>(result);

            Assert.AreEqual(start, actual.Start, "start");
            Assert.AreEqual(end, actual.End, "end");
        }