public void GetNonExistantPropertyException() { ObjectWrapper wrapper = new ObjectWrapper(new TestObject("Rick", 23)); PropertyAccessExceptionsException ex = new PropertyAccessExceptionsException(wrapper, new PropertyAccessException[] { }); PropertyAccessException nullException = ex.GetPropertyAccessException("Age"); Assert.IsNull(nullException); }
public void GetNonExistantPropertyException() { ObjectWrapper wrapper = new ObjectWrapper(new TestObject("Rick", 23)); PropertyAccessExceptionsException ex = new PropertyAccessExceptionsException(wrapper, new PropertyAccessException[] { }); PropertyAccessException nullException = ex.GetPropertyAccessException("Age"); Assert.IsNull(nullException); }
public void GetPropertyExceptions() { ObjectWrapper wrapper = new ObjectWrapper(new TestObject("Rick", 23)); PropertyAccessExceptionsException ex = new PropertyAccessExceptionsException(wrapper, new PropertyAccessException[] { new TypeMismatchException(new PropertyChangeEventArgs("Doctor", new NestedTestObject("Foo"), "rubbish"), typeof (INestedTestObject)), new MethodInvocationException(new TargetInvocationException("Bad format", new FormatException("'12' is not a valid argument for 'foo'..")), new PropertyChangeEventArgs("Friends", new ArrayList(), "trash")) }); PropertyAccessException doctorPropertyException = ex.GetPropertyAccessException("Doctor"); Assert.IsNotNull(doctorPropertyException); Assert.AreEqual("typeMismatch", doctorPropertyException.ErrorCode); Assert.AreEqual("Foo", ((NestedTestObject) doctorPropertyException.PropertyChangeArgs.OldValue).Company); PropertyAccessException friendsPropertyException = ex.GetPropertyAccessException("Friends"); Assert.IsNotNull(friendsPropertyException); Assert.AreEqual("methodInvocation", friendsPropertyException.ErrorCode); Assert.AreEqual(wrapper, ex.ObjectWrapper); Assert.AreEqual(wrapper.WrappedInstance, ex.BindObject); Assert.AreEqual(ex.Message, ex.ToString()); }
public void GetPropertyExceptions() { ObjectWrapper wrapper = new ObjectWrapper(new TestObject("Rick", 23)); PropertyAccessExceptionsException ex = new PropertyAccessExceptionsException(wrapper, new PropertyAccessException[] { new TypeMismatchException(new PropertyChangeEventArgs("Doctor", new NestedTestObject("Foo"), "rubbish"), typeof(INestedTestObject)), new MethodInvocationException(new TargetInvocationException("Bad format", new FormatException("'12' is not a valid argument for 'foo'..")), new PropertyChangeEventArgs("Friends", new ArrayList(), "trash")) }); PropertyAccessException doctorPropertyException = ex.GetPropertyAccessException("Doctor"); Assert.IsNotNull(doctorPropertyException); Assert.AreEqual("typeMismatch", doctorPropertyException.ErrorCode); Assert.AreEqual("Foo", ((NestedTestObject)doctorPropertyException.PropertyChangeArgs.OldValue).Company); PropertyAccessException friendsPropertyException = ex.GetPropertyAccessException("Friends"); Assert.IsNotNull(friendsPropertyException); Assert.AreEqual("methodInvocation", friendsPropertyException.ErrorCode); Assert.AreEqual(wrapper, ex.ObjectWrapper); Assert.AreEqual(wrapper.WrappedInstance, ex.BindObject); Assert.AreEqual(ex.Message, ex.ToString()); }