Пример #1
0
        public void SimpleData()
        {
            var simple = new SimpleDataObject(barack, null);

            simple.InitializeData();
            Assert.AreEqual(barack.Name, simple.Data[nameof(barack.Name)]);
            Assert.AreEqual(barack.Children, simple.Data[nameof(barack.Children)]);
            var clone = (Person)simple.Value;

            Assert.AreEqual(barack.Name, clone.Name);
            Assert.AreEqual(barack.Children, clone.Children);             // well, the DNA test would say they're the clone's as well ;)
        }
Пример #2
0
        public void AnyObjectSimpleData()
        {
            var timmy  = new Person("Timmy", null, null);
            var lassie = new Dog("Lassie", timmy);

            var simple = new SimpleDataObject(lassie, null);

            simple.InitializeData();
            Assert.AreEqual(lassie.Name, simple.Data[nameof(lassie.Name)]);
            Assert.AreEqual(lassie.Owner, simple.Data[nameof(lassie.Owner)]);
            var clone = (Dog)simple.Value;

            Assert.AreEqual(lassie.Name, clone.Name);
            Assert.AreEqual(lassie.Owner, clone.Owner);
        }