public void GetValueThrowsErrorIfMemberHasInvalidFormat() { var invoker = new SimpleDynamicInvoker(); Assert.Throws <ArgumentNullException>(() => invoker.GetValue(this, null)); Assert.Throws <ArgumentException>(() => invoker.GetValue(this, "")); Assert.Throws <ArgumentException>(() => invoker.GetValue(this, " broken ")); }
public void GetValueReturnsTheValueOfProperty() { var invoker = new SimpleDynamicInvoker(); var result = invoker.GetValue(this, nameof(PublicProperty)); Assert.AreEqual(nameof(PublicProperty), result); }
public void GetValueReturnsNullIfMemberIsNotAccessible() { var invoker = new SimpleDynamicInvoker(); var result = invoker.GetValue(this, nameof(_privateField)); Assert.IsNull(result); }
public void GetValueReturnsTrulyDynamicPropertyValue() { var invoker = new SimpleDynamicInvoker(); dynamic expando = new ExpandoObject(); expando.Property = 100; var result = invoker.GetValue(expando, nameof(expando.Property)); Assert.AreEqual(expando.Property, result); }
public void GetValueReturnsNullIfObjectIsNull() { var invoker = new SimpleDynamicInvoker(); Assert.IsNull(invoker.GetValue(null, "property")); }