/// <summary> /// Executes the code to be tested. /// </summary> protected override void Act() { var testObject = new DangerousTextTestObject("<Hello World>"); var validator = new DataAnnotationsEntityValidator(); _actualResults = validator.ValidateObject(testObject); }
/// <summary> /// Executes the code to be tested. /// </summary> protected override void Act() { var testObject = new DangerousTextTestObject("Moonshower"); // Includes 'onshow' var validator = new DataAnnotationsEntityValidator(); _actualResults = validator.ValidateObject(testObject); }
/// <summary> /// Executes the code to be tested. /// </summary> protected override void Act() { // Initialize dangerous value var testObject = new DangerousTextTestObject( @"\""}<script>var r=new XMLHttpRequest();</script>{, \""}<script>r.open('GET', document.location, false);r.send(null);</script>{, \""}<script>var h=r.getAllResponseHeaders().toLowerCase();</script>{, and \""}<script>alert(h);</script>{"); var validator = new DataAnnotationsEntityValidator(); _actualResults = validator.ValidateObject(testObject); }
/// <summary> /// Executes the code to be tested. /// </summary> protected override void Act() { var testObject = new RequiredCollectionTestObject { TestCollection = null }; var validator = new DataAnnotationsEntityValidator(); _actualResults = validator.ValidateObject(testObject); }
/// <summary> /// Executes the code to be tested. /// </summary> protected override void Act() { var testObject = new RequiredCollectionTestObject { TestCollection = new List <CollectionTestObject>() }; testObject.TestCollection.Add(new CollectionTestObject()); var validator = new DataAnnotationsEntityValidator(); _actualResults = validator.ValidateObject(testObject); }