54 lines
1.5 KiB
C#
54 lines
1.5 KiB
C#
using System;
|
|
using Endpoint;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
namespace EndpointTest
|
|
{
|
|
/// <summary>
|
|
///This is a test class for HtmlEndpointTest and is intended
|
|
///to contain all HtmlEndpointTest Unit Tests
|
|
///</summary>
|
|
[TestClass]
|
|
public class HtmlEndpointTest
|
|
{
|
|
// Random website for functional testing
|
|
private readonly Uri _goodUri = new Uri("http://www.seekwellness.com/sca/");
|
|
|
|
/// <summary>
|
|
///A test for HtmlEndpointConfiguration
|
|
///</summary>
|
|
[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);
|
|
}
|
|
|
|
/// <summary>
|
|
///A test for HtmlEndpointConfiguration
|
|
///</summary>
|
|
[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);
|
|
}
|
|
}
|
|
}
|