Index: Core/Common/test/Core.Common.Gui.Test/PropertyBag/PropertySpecTest.cs =================================================================== diff -u -ref1c61d94f2aec3b4ff32fcf03253d7ad386c8e5 -r26fc2b4d54fb58420d87643c071ca76d2b0a0249 --- Core/Common/test/Core.Common.Gui.Test/PropertyBag/PropertySpecTest.cs (.../PropertySpecTest.cs) (revision ef1c61d94f2aec3b4ff32fcf03253d7ad386c8e5) +++ Core/Common/test/Core.Common.Gui.Test/PropertyBag/PropertySpecTest.cs (.../PropertySpecTest.cs) (revision 26fc2b4d54fb58420d87643c071ca76d2b0a0249) @@ -134,7 +134,7 @@ } [Test] - public void SetValue_IncorrectInstanceType_ThrowArgumentException() + public void SetValue_IncorrectInstanceType_ThrowTargetException() { // Setup var target = new ClassWithProperties(); @@ -145,12 +145,11 @@ TestDelegate call = () => propertySpec.SetValue(new object(), 2); // Assert - var exception = Assert.Throws(call); - Assert.IsInstanceOf(exception.InnerException); + Assert.Throws(call); } [Test] - public void SetValue_InstanceIsNull_ThrowArgumentException() + public void SetValue_InstanceIsNull_ThrowTargetException() { // Setup var target = new ClassWithProperties(); @@ -161,11 +160,26 @@ TestDelegate call = () => propertySpec.SetValue(null, 2); // Assert - var exception = Assert.Throws(call); - Assert.IsInstanceOf(exception.InnerException); + Assert.Throws(call); } [Test] + public void SetValue_SettingValueResultsInException_ThrowTargetInvocationException() + { + // Setup + var target = new ClassWithProperties(); + + var propertySpec = new PropertySpec(target.GetType().GetProperty("ThrowsException")); + + // Call + TestDelegate call = () => propertySpec.SetValue(target, ""); + + // Assert + var innerException = Assert.Throws(call).InnerException; + Assert.IsInstanceOf(innerException); + } + + [Test] public void SetValue_PropertyWithoutPublicSet_ThrowInvalidOperationException() { // Setup @@ -367,6 +381,14 @@ [TypeConverter(typeof(SomeTypeConverter))] public string StringPropertyWithSomeTypeConverter { get; set; } + + public string ThrowsException + { + set + { + throw new ArgumentException(); + } + } } private class InheritorSettingPropertyToNotBrowsable : ClassWithProperties