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
{
// Random website for functional testing
private readonly Uri _goodUri = new Uri("http://www.seekwellness.com/sca/");
///
///A test for HtmlEndpointConfiguration
///
[TestMethod]
public void HtmlEndpointConfigurationTest()
{
var target = new HtmlEndpoint
{
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"
};
var status = target.GetStatus();
Assert.AreEqual(Status.Up, status, target.StatusDescription);
}
///
///A test for HtmlEndpointConfiguration
///
[TestMethod]
public void HtmlEndpointFormTest()
{
var target = new HtmlEndpoint
{
UriString = _goodUri.OriginalString,
XpathQuery = "//p[@class='errorMsg']/text()",
ExpectedXpathResult = "- Please enter a valid coupon code.",
RequestContent = "redeem_coupon=true&f_coupon_code=stuff"
};
var status = target.GetStatus();
Assert.AreEqual(Status.Up, status, target.StatusDescription);
}
}
}