protected void CheckEditingPermissions(UnitTestType unitTestType) { if (unitTestType.IsSystem) { throw new CantEditSystemObjectException(unitTestType.Id, Naming.UnitTestType); } }
/// <summary> /// Builds a unit test for a cookie collection. /// </summary> /// <param name="testType"> The test type.</param> /// <param name="cookies"> The cookie collection.</param> /// <returns> An edited cookie collection.</returns> public CookieCollection BuildUnitTestCookies(UnitTestType testType, CookieCollection cookies) { CookieCollection changedCookies = null; IHtmlFormUnitTest tester = null; // Call FillForm switch (testType) { case UnitTestType.BufferOverflow: tester = new BufferOverflowTester((BufferOverflowTesterArgs)this.Arguments); break; case UnitTestType.DataTypes: tester = new DataTypesTester((DataTypesTesterArgs)this.Arguments); break; case UnitTestType.SqlInjection: tester = new SqlInjectionTester((SqlInjectionTesterArgs)this.Arguments); break; case UnitTestType.XSS: tester = new XssInjectionTester((XssInjectionTesterArgs)this.Arguments); break; } if ( tester != null ) changedCookies = tester.FillCookies(cookies); return changedCookies; }
protected void CheckDeletingPermissions(UnitTestType unitTestType) { if (unitTestType.IsSystem) { throw new CantDeleteSystemObjectException(unitTestType.Id, Naming.UnitTestType); } if (unitTestType.IsDeleted) { throw new AlreadyDeletedException(unitTestType.Id, Naming.UnitTestType); } }
public static UnitTestTypeCacheWriteObject Create(UnitTestType unitTestType, Guid accountId) { if (unitTestType == null) { return(null); } var cache = new UnitTestTypeCacheWriteObject() { AccountId = accountId, Id = unitTestType.Id, IsDeleted = unitTestType.IsDeleted, CreateDate = unitTestType.CreateDate, SystemName = unitTestType.SystemName, DisplayName = unitTestType.DisplayName, NoSignalColor = unitTestType.NoSignalColor, ActualTimeSecs = unitTestType.ActualTimeSecs, IsSystem = unitTestType.IsSystem }; return(cache); }
/// <summary> /// Builds a unit test for a post data ArrayList. /// </summary> /// <param name="testType"> The test type to create.</param> /// <param name="postData"> The post data values to edit.</param> /// <returns> An edited post data ArrayList with applied test.</returns> public PostDataCollection BuildUnitTestPostData(UnitTestType testType, PostDataCollection postData) { PostDataCollection ret=null; IHtmlFormUnitTest tester; // Call FillPostData switch (testType) { case UnitTestType.BufferOverflow: tester = new BufferOverflowTester((BufferOverflowTesterArgs)this.Arguments); ret = tester.FillPostData(postData); break; case UnitTestType.DataTypes: tester = new DataTypesTester((DataTypesTesterArgs)this.Arguments); ret = tester.FillPostData(postData); break; case UnitTestType.Predefined: tester = new PredefinedTester(((PredefinedTesterArgs)this.Arguments)); ret = tester.FillPostData(postData); break; case UnitTestType.SqlInjection: tester = new SqlInjectionTester((SqlInjectionTesterArgs)this.Arguments); ret = tester.FillPostData(postData); break; case UnitTestType.XSS: tester = new XssInjectionTester((XssInjectionTesterArgs)this.Arguments); ret = tester.FillPostData(postData); break; } return ret; }
/// <summary> /// Builds a unit test for a uri. /// </summary> /// <param name="testType"> The test type</param> /// <param name="webServerUriType"> The web server url type.</param> /// <param name="url"> The uri data.</param> /// <returns> An edited cookie collection.</returns> public Uri BuildUnitTestGetRequest(UnitTestType testType, WebServerUriType webServerUriType, Uri url) { Uri result = null; IHtmlFormUnitTest tester = null; // Call FillForm switch (testType) { case UnitTestType.BufferOverflow: tester = new BufferOverflowTester((BufferOverflowTesterArgs)this.Arguments); break; case UnitTestType.DataTypes: tester = new DataTypesTester((DataTypesTesterArgs)this.Arguments); break; case UnitTestType.SqlInjection: tester = new SqlInjectionTester((SqlInjectionTesterArgs)this.Arguments); break; case UnitTestType.XSS: tester = new XssInjectionTester((XssInjectionTesterArgs)this.Arguments); break; } if ( tester != null ) result = tester.FillUri(url,webServerUriType); return result; }
/// <summary> /// Builds a unit test for a form. /// </summary> /// <param name="testType"> The test type to create.</param> /// <param name="form"> The form to edit.</param> /// <returns> An edited form tag with applied test.</returns> public HtmlFormTag BuildUnitTestForm(UnitTestType testType, HtmlFormTag form) { HtmlFormTag ret=null; IHtmlFormUnitTest tester; // Call FillForm switch (testType) { case UnitTestType.BufferOverflow: tester = new BufferOverflowTester((BufferOverflowTesterArgs)this.Arguments); ret = tester.FillForm(form); break; case UnitTestType.DataTypes: tester = new DataTypesTester((DataTypesTesterArgs)this.Arguments); ret = tester.FillForm(form); break; case UnitTestType.Predefined: tester = new PredefinedTester(((PredefinedTesterArgs)this.Arguments)); ret = tester.FillForm(form); break; case UnitTestType.SqlInjection: tester = new SqlInjectionTester((SqlInjectionTesterArgs)this.Arguments); ret = tester.FillForm(form); break; case UnitTestType.XSS: tester = new XssInjectionTester((XssInjectionTesterArgs)this.Arguments); ret = tester.FillForm(form); break; } return ret; }