WebTest.GetRequestEnumerator Method
When overridden in a derived class, returns an IEnumerator<T> interface that supports a simple iteration over a generic collection of WebTestRequest.
Namespace: Microsoft.VisualStudio.TestTools.WebTesting
Assembly: Microsoft.VisualStudio.QualityTools.WebTestFramework (in Microsoft.VisualStudio.QualityTools.WebTestFramework.dll)
Syntax
'Declaration
Public MustOverride Function GetRequestEnumerator As IEnumerator(Of WebTestRequest)
public abstract IEnumerator<WebTestRequest> GetRequestEnumerator()
public:
virtual IEnumerator<WebTestRequest^>^ GetRequestEnumerator() abstract
abstract GetRequestEnumerator : unit -> IEnumerator<WebTestRequest>
public abstract function GetRequestEnumerator() : IEnumerator<WebTestRequest>
Return Value
Type: System.Collections.Generic.IEnumerator<WebTestRequest>
An IEnumerator<T> that contains WebTestRequest objects.
Examples
The following example shows GetRequestEnumerator that contains a single WebTestRequest.
namespace TestProject1
{
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.WebTesting;
using ClassLibrary2;
public class MyWebTest : WebTest
{
public MyWebTest()
{
this.PreAuthenticate = true;
}
public override IEnumerator<WebTestRequest> GetRequestEnumerator()
{
WebTestRequest request1 = new WebTestRequest("https://localhost/ts");
ExtractCheckBoxes rule1 = new ExtractCheckBoxes();
rule1.FindCheckedBoxes = true;
rule1.ContextParameterName = "CheckedBoxes";
request1.ExtractValues += new EventHandler
<ExtractionEventArgs>(rule1.Extract);
ExtractCheckBoxes rule2 = new ExtractCheckBoxes();
rule2.FindCheckedBoxes = false;
rule2.ContextParameterName = "";
request1.ExtractValues += new EventHandler
<ExtractionEventArgs>(rule2.Extract);
yield return request1;
}
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.