mirror of
https://github.com/retailcrm/api-client-dotnet.git
synced 2024-11-22 12:56:03 +03:00
8ef01ecfb5
* update test to use env variables
54 lines
1.8 KiB
C#
54 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using Retailcrm;
|
|
using Retailcrm.Versions.V5;
|
|
|
|
namespace RetailcrmUnitTest.V5
|
|
{
|
|
[TestClass]
|
|
public class IntegrationTest
|
|
{
|
|
private readonly Client _client;
|
|
|
|
public IntegrationTest()
|
|
{
|
|
_client = new Client(
|
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
|
);
|
|
}
|
|
|
|
[TestMethod]
|
|
public void IntegrationsSettingsEditSettingsGet()
|
|
{
|
|
string uid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
|
|
|
Response response = _client.IntegrationsSettingsEdit(
|
|
new Dictionary<string, object>
|
|
{
|
|
{ "code", uid},
|
|
{ "name", $"TestIntegration-{uid}"},
|
|
{ "clientId", uid},
|
|
{ "active", true},
|
|
{ "accountUrl", $"http://{uid}.example.com"},
|
|
{ "logo", "https://www.ibm.com/cloud-computing/images/cloud/products/cloud-integration/api-economy-icon.svg"},
|
|
}
|
|
);
|
|
|
|
Debug.WriteLine(response.GetRawResponse());
|
|
Assert.IsTrue(response.IsSuccessfull());
|
|
Assert.IsInstanceOfType(response, typeof(Response));
|
|
Assert.IsTrue(response.GetResponse().ContainsKey("success"));
|
|
|
|
Response responseGet = _client.IntegrationsSettingGet(uid);
|
|
|
|
Debug.WriteLine(responseGet.GetRawResponse());
|
|
Assert.IsTrue(responseGet.IsSuccessfull());
|
|
Assert.IsInstanceOfType(responseGet, typeof(Response));
|
|
Assert.IsTrue(responseGet.GetResponse().ContainsKey("success"));
|
|
}
|
|
}
|
|
}
|