[TestMethod]
public void LoginDetailsParsing()
{
string testConnectionString = "S4S:user id=s4s.api@fuseit.com;password=x;token=XoTykMKTCti9mZUZeGw0mF823;environment=Production;proxyserver=192.168.5.124;proxyport=808";
LoginDetails loginDetails = new LoginDetails(testConnectionString);
Assert.AreEqual("s4s.api@fuseit.com", loginDetails.Username);
Assert.IsTrue(loginDetails.HasSecurityToken);
Assert.AreEqual("s4salesforceXoTykMKTCti9mZUZeGw0mF823", loginDetails.Password);
string connectionString = loginDetails.ConnectionString(false);
Assert.AreEqual(testConnectionString, connectionString);
}
[TestMethod]
public void LoginDetailsParsingWithPassword()
{
string testConnectionString = "S4S:user id=s4s.api@fuseit.com;password=x;token=XoTykMKTCti9mZUZeGw0mF823;environment=Production;proxyserver=192.168.5.124;proxyport=808;proxyusername=sean;proxypassword=y";
LoginDetails loginDetails = new LoginDetails(testConnectionString);
Assert.AreEqual("s4s.api@fuseit.com", loginDetails.Username);
Assert.IsTrue(loginDetails.HasSecurityToken);
Assert.AreEqual("s4salesforceXoTykMKTCti9mZUZeGw0mF823", loginDetails.Password);
string connectionString = loginDetails.ConnectionString(false);
Assert.AreEqual(testConnectionString, connectionString);
// Test the connection
SalesforceSession testSession = new SalesforceSession(new LoginDetails(testConnectionString));
string userId = testSession.SalesforceUserId;
UserService userService = new UserService(testSession);
Assert.IsTrue(userService.ValidEntityId(userId));
}