using System;
using Endpoint;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace EndpointTest
{
///
///This is a test class for HtmlEndpointTest and is intended
///to contain all HtmlEndpointTest Unit Tests
///
[TestClass()]
public class HtmlEndpointTest
{
private readonly Uri _goodUri = new Uri("http://www.seekwellness.com/sca/");
///
///A test for HtmlEndpointConfiguration
///
[TestMethod]
public void HtmlEndpointConfigurationTest()
{
HtmlEndpointConfiguration config =
new HtmlEndpointConfiguration {
UriString = _goodUri.OriginalString,
XpathQuery = "//td[contains(text(), 'Use this form')]/text()",
ExpectedXpathResult = "Use this form to order your",
RequestContent = "redeem_coupon=true&f_coupon_code=stuff"
};
HtmlEndpoint target = new HtmlEndpoint(config); // TODO: Initialize to an appropriate value
Status status = target.GetStatus();
}
///
///A test for HtmlEndpointConfiguration
///
[TestMethod]
public void HtmlEndpointFormTest()
{
HtmlEndpointConfiguration config =
new HtmlEndpointConfiguration
{
UriString = _goodUri.OriginalString,
XpathQuery = "//p[@class='errorMsg']/text()",
ExpectedXpathResult = "- Please enter a valid coupon code.",
RequestContent = "redeem_coupon=true&f_coupon_code=stuff"
};
HtmlEndpoint target = new HtmlEndpoint(config); // TODO: Initialize to an appropriate value
Status status = target.GetStatus();
Assert.AreEqual(Status.Up, status, target.StatusDescription);
}
}
}