2017-10-30 13:51:45 +03:00
|
|
|
|
using System.Collections.Specialized;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
|
|
|
using Retailcrm;
|
|
|
|
|
|
|
|
|
|
namespace RetailcrmUnitTest
|
|
|
|
|
{
|
|
|
|
|
[TestClass]
|
|
|
|
|
public class ApiTest
|
|
|
|
|
{
|
|
|
|
|
private readonly Connection _connection;
|
|
|
|
|
|
|
|
|
|
public ApiTest()
|
|
|
|
|
{
|
2018-03-21 15:56:36 +03:00
|
|
|
|
_connection = new Connection(
|
|
|
|
|
System.Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
|
|
|
|
System.Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
|
|
|
|
);
|
2017-10-30 13:51:45 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void Versions()
|
|
|
|
|
{
|
|
|
|
|
Response response = _connection.Versions();
|
|
|
|
|
|
|
|
|
|
Assert.IsTrue(response.IsSuccessfull());
|
|
|
|
|
Assert.IsInstanceOfType(response, typeof(Response));
|
|
|
|
|
Assert.IsTrue(response.GetResponse().ContainsKey("versions"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[TestMethod]
|
|
|
|
|
public void Credentials()
|
|
|
|
|
{
|
|
|
|
|
Response response = _connection.Credentials();
|
|
|
|
|
|
|
|
|
|
Assert.IsTrue(response.IsSuccessfull());
|
|
|
|
|
Assert.IsInstanceOfType(response, typeof(Response));
|
|
|
|
|
Assert.IsTrue(response.GetResponse().ContainsKey("credentials"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|