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