public void PropertyInjectorCanGetReferenceType() { PropertyInfo property = typeof(PropertyAndFieldInvocationObject).GetProperty("Message", BindingFlags.Public | BindingFlags.Instance); IPropertyInjector injector = Factory.GetInjector(property); Assert.That(injector, Is.Not.Null); PropertyAndFieldInvocationObject mock = new PropertyAndFieldInvocationObject(); mock.Message = "Hello, world!"; string message = (string)injector.Get(mock); Assert.That(message, Is.EqualTo("Hello, world!")); }
public void PropertyInjectorCanGetValueType() { PropertyInfo property = typeof(PropertyAndFieldInvocationObject).GetProperty("Value", BindingFlags.Public | BindingFlags.Instance); IPropertyInjector injector = Factory.GetInjector(property); Assert.That(injector, Is.Not.Null); PropertyAndFieldInvocationObject mock = new PropertyAndFieldInvocationObject(); mock.Value = 42; int value = (int)injector.Get(mock); Assert.That(value, Is.EqualTo(42)); }