public void GetFirstLevelPropertyUnknown()
            {
                Animal dodo = new Animal(true);
                object value;
                bool result = dodo.TryGetPropertyValue("DoesNotExist", out value);

                Assert.IsFalse(result);
            }
            public void GetFirstLevelProperty()
            {
                Animal dodo = new Animal(true);
                object value;
                bool result = dodo.TryGetPropertyValue("Extinct", out value);

                Assert.IsTrue(result);
                Assert.AreEqual(true, value);
            }
            public void GetFirstLevelPropertyNull()
            {
                Animal dodo = new Animal(true);
                object value;
                bool result = dodo.TryGetPropertyValue("ScientificName", out value);

                Assert.IsTrue(result);
                Assert.IsNull(value);
            }
        public void TestPublicProperty()
        {
            Animal animal = new Animal(false)
                            {
                                ScientificName = "Raphus cucullatus"
                            };
            Ave dodo = new Ave(true);

            Assert.IsTrue(string.IsNullOrEmpty(dodo.ScientificName));
            dodo.IntialiseFrom(animal);
            Assert.AreEqual("Raphus cucullatus", dodo.ScientificName);
        }
        public void TestPrivateProperty()
        {
            Animal animal = new Animal
                            {
                                ScientificName = "Raphus cucullatus"
                            };
            Ave dodo = new Ave();
            dodo.SetHiddenProperty(string.Empty);

            Assert.AreEqual("Secret Value", animal.GetHiddenProperty());
            Assert.IsTrue(string.IsNullOrEmpty(dodo.GetHiddenProperty()));
            dodo.IntialiseFrom(animal);
            Assert.IsTrue(string.IsNullOrEmpty(dodo.GetHiddenProperty()));
        }
            public void GetFirstLevelPropertyComplexType()
            {
                Animal dodo = new Animal(true)
                {
                    Characteristics = new AnimalCharacteristics
                    {
                        CanFly = false,
                        NativeLocation = "Mauritius"
                    }
                };

                object value;
                bool result = dodo.TryGetPropertyValue("Characteristics", out value);

                Assert.IsTrue(result);
                Assert.AreEqual(dodo.Characteristics, value);
            }
            public void GetDictionaryValue()
            {
                Animal dodo = new Animal(true)
                {
                    Characteristics = new AnimalCharacteristics
                    {
                        OtherProperties = new Dictionary<string, string>
                                          {
                            { "Foo", "Bar" },
                            { "Baz", "Qux" }
                        }
                    }
                };

                object value;
                bool result = dodo.TryGetPropertyValue("Characteristics.OtherProperties.Baz", '.', out value);

                Assert.IsTrue(result);
                Assert.AreEqual("Qux", value);
            }
            public void GetSecondLevelProperty()
            {
                Animal dodo = new Animal(true)
                {
                    Characteristics = new AnimalCharacteristics
                    {
                        CanFly = false,
                        NativeLocation = "Mauritius"
                    }
                };

                object value;
                bool result = dodo.TryGetPropertyValue("Characteristics.NativeLocation", '.', out value);

                Assert.IsTrue(result);
                Assert.AreEqual("Mauritius", value);
            }
            public void GetSecondLevelPropertyUnknownParent()
            {
                Animal dodo = new Animal(true);

                object value;
                bool result = dodo.TryGetPropertyValue("DoesNotExist.NativeLocation", '.', out value);

                Assert.IsFalse(result);
            }
            public void GetSecondLevelPropertyUnknown()
            {
                Animal dodo = new Animal(true)
                {
                    Characteristics = new AnimalCharacteristics()
                };

                object value;
                bool result = dodo.TryGetPropertyValue("Characteristics.DoesNotExist", '.', out value);

                Assert.IsFalse(result);
            }
            public void GetSecondLevelPropertyNullParent()
            {
                Animal dodo = new Animal(true)
                {
                    Characteristics = null
                };

                object value;
                bool result = dodo.TryGetPropertyValue("Characteristics.NativeLocation", '.', out value);

                Assert.IsTrue(result);
                Assert.IsNull(value);
            }