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 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 GetFirstLevelPropertyUnknown() { Animal dodo = new Animal(true); object value; bool result = dodo.TryGetPropertyValue("DoesNotExist", out value); Assert.IsFalse(result); }
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); }