using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Extensions.Web.Html;
using NUnit.Extensions.Web.HtmlDom;
namespace NUnit.Extensions.Web.AspNet
{
public class CheckBoxTester : InputCheckBoxTester, AspNetControlTester
{
public CheckBoxTester(WebBrowser brsr, string id, AspNetControlTester scope)
: base(brsr, new AspNetElementQuery(brsr, scope), CreateAspNetId(scope, id))
{
}
public CheckBoxTester(WebBrowser brsr, string id)
: base(brsr, IElementLocator.GetDocumentIdLocator(brsr), id)
{
}
public CheckBoxTester(string id, AspNetControlTester scope)
: base(WebBrowser.Browser, new AspNetElementQuery(WebBrowser.Browser, scope), CreateAspNetId(scope, id))
{
}
public CheckBoxTester(string id)
: base(WebBrowser.Browser, IElementLocator.GetDocumentIdLocator(WebBrowser.Browser), id)
{
}
public string Text
{
get
{
StructuredDocument label = Label;
if (label == null)
{
return "";
}
return label.Root.InnerHtml;
}
}
private StructuredDocument Label
{
get
{
int idx = Tag.Index;
Tag tag = (Tag)Browser.Document.Elements[idx + 1];
if (tag.TagName != "label")
{
return null;
}
StructuredDocument doc = new StructuredDocument(Browser.Document, tag);
return doc;
}
}
}
}