public void CanGetReadonlyProperty() { var sut = new PropertyInvocationsMirror(); PropertyValueMirror rv = sut.PrivateReadonlyProperty; Assert.IsInstanceOfType(rv, typeof(PropertyValueMirror)); Assert.AreEqual(24, rv.Value); }
public void CanGetPrivateStaticProperty() { var value = new PropertyValueMirror { Value = 42 }; PropertyInvocationsMirror.PrivateStaticPropertyField = value; PropertyValueMirror rv = PropertyInvocationsMirror.PrivateStaticProperty; Assert.AreEqual(42, rv.Value); var invocation = MethodInvocation.Invocations.Single(); Assert.AreEqual(nameof(PropertyInvocationsMirror.PrivateStaticProperty) + "_get", invocation.MemberName); Assert.AreEqual(typeof(PropertyInvocationsMirror).GetMirrorClass(), invocation.ContainingType.FullName); }
public void CanSetPrivateProperty() { var sut = new PropertyInvocationsMirror(); var value = new PropertyValueMirror { Value = 42 }; sut.PrivateProperty = value; PropertyValueMirror fieldValue = sut.PrivatePropertyField; Assert.AreEqual(42, fieldValue.Value); var invocation = MethodInvocation.Invocations.Single(); Assert.AreEqual(nameof(PropertyInvocationsMirror.PrivateProperty) + "_set", invocation.MemberName); Assert.AreEqual(typeof(PropertyInvocationsMirror).GetMirrorClass(), invocation.ContainingType.FullName); }