public void IsValid_Object() { var attr = new ValidateFooAttribute(); AssertExtensions.Throws <NotImplementedException> (() => { // It calls IsValid (object, validationContext) which throws the NIEX, but when that overload is called directly, there's // no exception. // // at System.ComponentModel.DataAnnotations.ValidationAttribute.IsValid(Object value, ValidationContext validationContext) // at System.ComponentModel.DataAnnotations.ValidationAttribute.IsValid(Object value) // at MonoTests.System.ComponentModel.DataAnnotations.ValidationAttributeTest.IsValid_Object() in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\ValidationAttributeTest.cs:line 450 attr.IsValid(null); }, "#A1-1"); AssertExtensions.Throws <NotImplementedException> (() => { attr.IsValid("stuff"); }, "#A1-2"); }
public void IsValid_Object() { var attr = new ValidateFooAttribute(); try { attr.IsValid(null); Assert.Fail("#A1-1"); } catch (NotImplementedException) { // success } try { attr.IsValid("stuff"); Assert.Fail("#A1-2"); } catch (NotImplementedException) { // success } }
public void IsValid_Object () { var attr = new ValidateFooAttribute (); try { attr.IsValid (null); Assert.Fail ("#A1-1"); } catch (NotImplementedException) { // success } try { attr.IsValid ("stuff"); Assert.Fail ("#A1-2"); } catch (NotImplementedException) { // success } }
public void IsValid_Object () { var attr = new ValidateFooAttribute (); AssertExtensions.Throws <NotImplementedException> (() => { // It calls IsValid (object, validationContext) which throws the NIEX, but when that overload is called directly, there's // no exception. // // at System.ComponentModel.DataAnnotations.ValidationAttribute.IsValid(Object value, ValidationContext validationContext) // at System.ComponentModel.DataAnnotations.ValidationAttribute.IsValid(Object value) // at MonoTests.System.ComponentModel.DataAnnotations.ValidationAttributeTest.IsValid_Object() in C:\Users\grendel\Documents\Visual Studio 2010\Projects\System.Web.Test\System.Web.Test\System.ComponentModel.DataAnnotations\ValidationAttributeTest.cs:line 450 attr.IsValid (null); }, "#A1-1"); AssertExtensions.Throws <NotImplementedException> (() => { attr.IsValid ("stuff"); }, "#A1-2"); }