#include "se/ContactCheckResponse.hpp"
#include "xml/XMLParser.hpp"
#include "session/Timer.hpp"
#include "common/Test.hpp"
#include "common/init.hpp"
using namespace std;
void doWork()
{
init("etc/toolkit2.conf");
const string xml = "Command completed successfullysh8013sah8013In use8013sahABC-1234554322-XYZ";
ContactCheckResponse response;
XMLParser parser;
std::auto_ptr doc(parser.parse(xml));
response.fromXML(doc.get());
ASSERT_EQ(response.isAvailable("sh8013"), true);
ASSERT_EQ(response.isAvailable("sah8013"), false);
ASSERT_EQ(response.isAvailable("8013sah"), true);
ASSERT_EQ(response.getReason("sah8013"), "In use");
ASSERT_EQ(response.getReason(1), "In use");
{
vector availList(response.getAvailableList());
ASSERT_EQ(availList.size(), 3);
ASSERT_EQ(availList[0], true);
ASSERT_EQ(availList[1], false);
ASSERT_EQ(availList[2], true);
}
{
vector reasonList(response.getReasonList());
ASSERT_EQ(reasonList.size(), 3);
ASSERT_EQ(reasonList[1], "In use");
}
}
int main(int argc, char* argv[])
{
TEST_run(doWork);
return TEST_errorCount();
}