예제 #1
0
파일: PODSlim.cs 프로젝트: zhabis/nfx
        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));
            }
        }
예제 #2
0
파일: POD.cs 프로젝트: 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));
        }