/// <summary> /// Creates a new UnitTestItem. /// </summary> /// <param name="form"> The form that the tests will be applied.</param> /// <param name="tests"> The test collection.</param> public UnitTestItem(HtmlFormTag form, TestCollection tests) { this.Form = form; this.Tests = tests; }
private void LoadUnitTests(TestCollection tests) { // Clear items this.cmbUnitTest.Items.Clear(); // load tests foreach ( DictionaryEntry de in tests ) { this.cmbUnitTest.Items.Add(de.Key); } _currentTests = tests; }
/// <summary> /// Opens a template from file. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mnuOpenTemplate_Click(object sender, System.EventArgs e) { // send this to disk System.IO.Stream stream = null; dlgOpenFile.CheckFileExists = true; dlgOpenFile.InitialDirectory = Application.UserAppDataPath; dlgOpenFile.RestoreDirectory = true; dlgOpenFile.Filter = "Web Unit Test Template Files (*.gbtt)|*.gbtt"; dlgOpenFile.Title = "Open Web Unit Test Template"; if ( dlgOpenFile.ShowDialog() == DialogResult.OK ) { Application.DoEvents(); tempCursor = Cursor.Current; Cursor.Current = Cursors.WaitCursor; // file stream = dlgOpenFile.OpenFile(); if ( stream != null ) { try { _tests = OpenTemplate(stream); LoadTestManager(); } catch ( Exception ex ) { MessageBox.Show(ex.Message,AppLocation.ApplicationName,MessageBoxButtons.OK, MessageBoxIcon.Error); } } } if (stream != null) { Cursor.Current = tempCursor; stream.Close(); } }
/// <summary> /// Creates a shallow copy of the <b>TestCollection</b>. /// </summary> /// <returns>A shallow copy of the <see cref="TestCollection"/>.</returns> public virtual object Clone() { TestCollection newList = new TestCollection(count); Array.Copy(keys, 0, newList.keys, 0, count); Array.Copy(values, 0, newList.values, 0, count); newList.count = count; newList.version = version; newList.comparer = comparer; return newList; }
internal KeyList(TestCollection list) { this.list = list; }
/// <summary> /// Returns a synchronized (thread-safe) wrapper for the <b>TestCollection</b>. /// </summary> /// <param name="list">The <see cref="TestCollection"/> to synchronize.</param> /// <returns>A synchronized (thread-safe) wrapper for the <see cref="TestCollection"/>.</returns> /// <exception cref="ArgumentNullException"><paramref name="list"/> is a null reference.</exception> public static TestCollection Synchronized(TestCollection list) { if (list == null) throw new ArgumentNullException("list", "The list cannot be null."); return new SyncSortedList(list); }
internal ValueList(TestCollection list) { this.list = list; }
internal SyncSortedList(TestCollection list) { this.list = list; this.root = list.SyncRoot; }
internal SortedListEnumerator(TestCollection list, int index, int count, int returnType) { this.list = list; this.index = index; this.startIndex = index; this.endIndex = index + count; this.version = list.version; this.returnType = returnType; this.currentValid = false; }
/// <summary> /// Creates the easy test for the command. /// </summary> /// <returns> A test collection</returns> private TestCollection GetTests() { TestCollection tests = new TestCollection(); if ( BufferTest ) { Test bufferTest = new Test(); bufferTest.Name = "EasyBufferTest"; bufferTest.TestType = UnitTestType.BufferOverflow; if ( this._bufferLen != 0 ) { bufferTest.Arguments = new BufferOverflowTesterArgs(this._bufferLen); } else { bufferTest.Arguments = new BufferOverflowTesterArgs(300); } tests.Add(bufferTest.Name, bufferTest); } if ( XssTest ) { Test xssTest = new Test(); xssTest.Name = "EasyXSSTest"; xssTest.TestType = UnitTestType.XSS; if ( this._xssSignature.Length > 0 ) { xssTest.Arguments = new XssInjectionTesterArgs(this._xssSignature); } else { xssTest.Arguments = new XssInjectionTesterArgs("<script>alert('XSS Test: You have been hacked!');</script>"); } tests.Add(xssTest.Name, xssTest); } if ( SqlTest ) { Test sqlTest = new Test(); sqlTest.Name = "EasySQLTest"; sqlTest.TestType = UnitTestType.SqlInjection; if ( this._sqlSignature.Length > 0 ) { sqlTest.Arguments = new SqlInjectionTesterArgs(this._sqlSignature); } else { sqlTest.Arguments = new SqlInjectionTesterArgs("'1=1 --"); } tests.Add(sqlTest.Name, sqlTest); } return tests; }