コード例 #1
0
        /// <summary>
        /// Creates a test argument.
        /// </summary>
        private Test CreateWebUnitTest()
        {
            IHtmlFormUnitTestArgs args = null;
            Test test = new Test();

            #region Buffer Overflow Settings
            if ( this.rbBufferOverflow.Checked )
            {
                args = new BufferOverflowTesterArgs();
                ((BufferOverflowTesterArgs)args).BufferLength = (int)this.numBufferLen.Value;

                test.TestType = UnitTestType.BufferOverflow;
                test.TestTypeName = "Buffer Overflow Test";
                test.Name = this.txtTestName.Text;
                test.Arguments = args;
            }
            #endregion

            #region Data Type Settings
            if ( this.rbDataType.Checked )
            {
                args = new DataTypesTesterArgs();
                ((DataTypesTesterArgs)args).SelectedDataType = (DataType)dataTypesList.GetKey(dataTypesList.IndexOfValue(this.cmbDataType.Text));

                test.TestType= UnitTestType.DataTypes;
                test.TestTypeName = "Data Type Test";
                test.Name  = this.txtTestName.Text;
                test.Arguments = args;
            }
            #endregion

            #region SQL Injection Settings
            if ( this.rbSqlTest.Checked )
            {
                args = new SqlInjectionTesterArgs();
                ((SqlInjectionTesterArgs)args).SqlValue = this.cmbSqlTestValues.Text;

                test.TestType = UnitTestType.SqlInjection;
                test.TestTypeName = "SQL Injection Test";
                test.Name = this.txtTestName.Text;
                test.Arguments = args;
            }
            #endregion

            #region XSS Settings
            if ( this.rbXSSTest.Checked )
            {
                args = new XssInjectionTesterArgs();
                ((XssInjectionTesterArgs)args).XssValue = this.cmbXssTestValues.Text;

                test.TestType = UnitTestType.XSS;
                test.TestTypeName = "XSS Injection Test";
                test.Name = this.txtTestName.Text;
                test.Arguments = args;
            }
            #endregion

            return test;
        }
コード例 #2
0
 /// <summary>
 /// Creates a new XssInjectionTester.
 /// </summary>
 /// <param name="args"> The xss injection tester arguments.</param>
 public XssInjectionTester(XssInjectionTesterArgs args)
 {
     this.UnitTestName = "XssInjectionTester";
     this.XssValue = args.XssValue;
 }