示例#1
0
        public void test_input_of_type_complexclass_for_xss_validation_without_injection()
        {
            var objTestComplexClass21 = new TestComplexClass2 {
                DeptId = 1, DeptName = "Sample"
            };
            var objTestComplexClass22 = new TestComplexClass2 {
                DeptId = 1, DeptName = "Employee"
            };
            var objtestComplexClass1 = new TestComplexClass1
            {
                Age  = 1,
                Name = "physics",
                Dept = new List <TestComplexClass2> {
                    objTestComplexClass21, objTestComplexClass22
                }
            };
            var result = Validator.ValidateForXssScriptSequential <TestComplexClass1>(objtestComplexClass1);

            Assert.AreEqual(result, true);
        }
示例#2
0
        public void test_input_of_type_complexclass_for_xss_validation_with_injection()
        {
            var objTestComplexClass21 = new TestComplexClass2 {
                DeptId = 1, DeptName = "Delete"
            };
            var objTestComplexClass22 = new TestComplexClass2 {
                DeptId = 1, DeptName = "Employee"
            };
            var objtestComplexClass1 = new TestComplexClass1
            {
                Age  = 1,
                Name = "Sample",
                Dept = new List <TestComplexClass2> {
                    objTestComplexClass21, objTestComplexClass22
                }
            };
            var result = Validator.ValidateForXssScriptSequential <TestComplexClass2>(objtestComplexClass1.Dept.FirstOrDefault());

            Assert.AreEqual(result, false);
        }
示例#3
0
        public void test_input_of_type_complexclass_for_xss_validation()
        {
            var objTestComplexClass21 = new TestComplexClass2 {
                DeptId = 1, DeptName = "Sample<script>"
            };
            var objTestComplexClass22 = new TestComplexClass2 {
                DeptId = 1, DeptName = "Delete from Employee"
            };
            var objtestComplexClass1 = new TestComplexClass1
            {
                Age  = 1,
                Name = "Drop Table Table1",
                Dept = new List <TestComplexClass2> {
                    objTestComplexClass21, objTestComplexClass22
                }
            };
            var result = Validator.ValidateForXssScriptSequential <TestComplexClass1>(objtestComplexClass1);

            Assert.AreEqual(result, false);
        }