Files
2025-10-11 09:42:00 -04:00

63 lines
2.3 KiB
C#

using Endpoint;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace EndpointTest
{
/// <summary>
/// Functional Tests for SoapEndpoint
/// </summary>
[TestClass]
public class SoapEndpointTest
{
// Random internet webservice
private const string URISTRING = @"http://www.weather.gov/forecasts/xml/SOAP_server/ndfdXMLserver.php";
private const string SOAPACTION =
@"http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl#GmlTimeSeries";
private const string SOAPREQUEST =
@"<soapenv:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soapenv=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:ndf=""http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl"">"
+ @" <soapenv:Header/>"
+ @" <soapenv:Body>"
+ @" <ndf:GmlTimeSeries soapenv:encodingStyle=""http://schemas.xmlsoap.org/soap/encoding/"">"
+ @" <listLatLon xsi:type=""dwml:listLatLonType"" xmlns:dwml=""http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd"">?</listLatLon>"
+ @" <startTime xsi:type=""xsd:dateTime"">?</startTime>"
+ @" <endTime xsi:type=""xsd:dateTime"">?</endTime>"
+ @" <compType xsi:type=""dwml:compTypeType"" xmlns:dwml=""http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd"">?</compType>"
+ @" <featureType xsi:type=""dwml:featureTypeType"" xmlns:dwml=""http://www.weather.gov/forecasts/xml/DWMLgen/schema/DWML.xsd"">?</featureType>"
+ @" <propertyName xsi:type=""xsd:string"">?</propertyName>"
+ @" </ndf:GmlTimeSeries>"
+ @" </soapenv:Body>"
+ @"</soapenv:Envelope>";
private const string XPATHNAMESPACES =
@"a,http://www.opengis.net/ows";
private const string XPATHQUERY =
@"//a:Exception[1]/@ExceptionText";
private const string EXPECTEDXPATHRESULT =
@"VERSION key not found";
/// <summary>
/// Runs GetStatus
/// </summary>
[TestMethod]
public void GetStatusTest()
{
var target = new SoapEndpoint
{
UriString = URISTRING,
XpathQuery = XPATHQUERY,
ExpectedXpathResult = EXPECTEDXPATHRESULT,
SoapAction = SOAPACTION,
SoapRequest = SOAPREQUEST,
XpathNamespaces = XPATHNAMESPACES
};
var status = target.GetStatus();
Assert.AreEqual(Status.Up, status);
}
}
}