Beispiel #1
0
        public void RootCompositeWriteRead_BusinessFamily()
        {
            using (var ms = new MemoryStream())//new FileStream(@"c:\nfx\TEMP.POD", FileMode.Create))// new MemoryStream())
            {
                var s = new PODSlimSerializer();

                var originalData =
                    new TestBusinessFamily {
                    Husband = new TestPerson {
                        Name = "Kolyan Zver'", DOB = DateTime.Now, Assets = 2000000, IsRegistered = true, Luck = 150.5489
                    },
                    Wife = new TestPerson {
                        Name = "Feiga Pozman", DOB = DateTime.Now, Assets = 578, IsRegistered = false, Luck = 250.489
                    },
                    Kid = new TestPerson {
                        Name = "Mykola Zver'", DOB = DateTime.Now, Assets = 12, IsRegistered = true, Luck = 350.189
                    },
                    Assets      = 9000000000,
                    IsCertified = true
                };

                s.Serialize(ms, originalData);

                ms.Seek(0, SeekOrigin.Begin);

                var convertedData = s.Deserialize(ms);

                Aver.IsFalse(object.ReferenceEquals(originalData, convertedData));

                Aver.IsTrue(originalData.Equals(convertedData));
            }
        }
Beispiel #2
0
Datei: POD.cs Projekt: zhabis/nfx
        public void RootCompositeWriteRead_BusinessFamily()
        {
            var originalData =
                new TestBusinessFamily {
                Husband = new TestPerson {
                    Name = "Kolyan Zver'", DOB = DateTime.Now, Assets = 2000000, IsRegistered = true, Luck = 150.5489
                },
                Wife = new TestPerson {
                    Name = "Feiga Pozman", DOB = DateTime.Now, Assets = 578, IsRegistered = false, Luck = 250.489
                },
                Kid = new TestPerson {
                    Name = "Mykola Zver'", DOB = DateTime.Now, Assets = 12, IsRegistered = true, Luck = 350.189
                },
                Assets      = 9000000000,
                IsCertified = true
            };


            var doc = new PortableObjectDocument(originalData);

            var convertedData = doc.ToOriginalObject() as TestFamily;

            Aver.IsFalse(object.ReferenceEquals(originalData, convertedData));

            Aver.IsTrue(originalData.Equals(convertedData));
        }