mirror of
https://github.com/retailcrm/api-client-dotnet.git
synced 2024-11-21 12:26:03 +03:00
parent
b5261b02b0
commit
8ef01ecfb5
1
.gitignore
vendored
1
.gitignore
vendored
@ -261,5 +261,4 @@ paket-files/
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
*.nuspec
|
||||
*.nupkg
|
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-2017 RetailDriver LLC
|
||||
Copyright (c) 2015-2018 RetailDriver LLC
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
22
README.md
22
README.md
@ -1,19 +1,19 @@
|
||||
.NET-клиент RetailCRM API
|
||||
=========================
|
||||
[![NuGet](https://img.shields.io/nuget/v/Retailcrm.SDK.svg)](https://www.nuget.org/packages/Retailcrm.SDK/)
|
||||
|
||||
.NET-клиент для работы с [RetailCRM API](http://www.retailcrm.ru/docs/Developers/Index). Клиент поддерживает все доступные на текущий момент версии API (v3-v5).
|
||||
|
||||
Установка через NuGet
|
||||
---------------------
|
||||
# retailCRM API C# client
|
||||
|
||||
This is C# retailCRM API client. This library allows to use all available API versions.
|
||||
|
||||
## Install
|
||||
|
||||
``` bash
|
||||
PM> Install-Package Retailcrm.SDK
|
||||
```
|
||||
|
||||
Примеры использования
|
||||
---------------------
|
||||
## Usage
|
||||
|
||||
### Получение информации о заказе
|
||||
### Get order
|
||||
|
||||
``` csharp
|
||||
using System.Diagnostics;
|
||||
@ -31,7 +31,7 @@ if (response.isSuccessful()) {
|
||||
}
|
||||
|
||||
```
|
||||
### Создание заказа
|
||||
### Create order
|
||||
|
||||
``` csharp
|
||||
using System.Diagnostics;
|
||||
@ -71,3 +71,7 @@ if (response.isSuccessful()) {
|
||||
}
|
||||
|
||||
```
|
||||
### Documentation
|
||||
|
||||
* [English](http://www.retailcrm.pro/docs/Developers/Index)
|
||||
* [Russian](http://www.retailcrm.ru/docs/Developers/Index)
|
||||
|
18
Retailcrm/Retailcrm.nuspec
Normal file
18
Retailcrm/Retailcrm.nuspec
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<package >
|
||||
<metadata>
|
||||
<id>Retailcrm.SDK</id>
|
||||
<version>5.1.1</version>
|
||||
<title>$title$</title>
|
||||
<authors>Retailcrm</authors>
|
||||
<owners>Retailcrm</owners>
|
||||
<licenseUrl>https://opensource.org/licenses/MIT</licenseUrl>
|
||||
<projectUrl>http://retailcrm.ru</projectUrl>
|
||||
<iconUrl>http://www.retailcrm.ru/favicon.ico</iconUrl>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>Multiversion API client for RetailCRM</description>
|
||||
<releaseNotes>Update tests, setup auto builds</releaseNotes>
|
||||
<copyright>Copyright 2017-2018</copyright>
|
||||
<tags>crm ecommerce retailcrm sdk</tags>
|
||||
</metadata>
|
||||
</package>
|
@ -12,8 +12,10 @@ namespace RetailcrmUnitTest
|
||||
|
||||
public ApiTest()
|
||||
{
|
||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
||||
_connection = new Connection(appSettings["apiUrl"], appSettings["apiKey"]);
|
||||
_connection = new Connection(
|
||||
System.Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
System.Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="apiUrl" value="https://example.retailcrm.ru"/>
|
||||
<add key="apiKey" value="BBBBBBBBBBBBBBBBBBBBBBBBBBBB"/>
|
||||
<add key="site" value="default"/>
|
||||
<add key="store" value="test-store"/>
|
||||
<add key="manager" value="1"/>
|
||||
<add key="customer" value="1" />
|
||||
<add key="phone" value="+79999999999"/>
|
||||
</appSettings>
|
||||
</configuration>
|
@ -81,8 +81,6 @@
|
||||
<Compile Include="V5\SegmentsTest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="App.config.dist" />
|
||||
<None Include="packages.config">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V3;
|
||||
|
||||
@ -13,8 +11,10 @@ namespace RetailcrmUnitTest.V3
|
||||
|
||||
public ClientTest()
|
||||
{
|
||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"], appSettings["site"]);
|
||||
_client = new Client(
|
||||
System.Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
System.Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V3;
|
||||
@ -12,12 +10,13 @@ namespace RetailcrmUnitTest.V3
|
||||
public class CustomersTest
|
||||
{
|
||||
private readonly Client _client;
|
||||
private readonly NameValueCollection _appSettings;
|
||||
|
||||
public CustomersTest()
|
||||
{
|
||||
_appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -102,7 +101,7 @@ namespace RetailcrmUnitTest.V3
|
||||
[TestMethod]
|
||||
public void CustomersList()
|
||||
{
|
||||
_client.SetSite(_appSettings["site"]);
|
||||
_client.SetSite(Environment.GetEnvironmentVariable("RETAILCRM_SITE"));
|
||||
|
||||
Response response = _client.CustomersList();
|
||||
|
||||
|
@ -15,8 +15,10 @@ namespace RetailcrmUnitTest.V3
|
||||
|
||||
public OrdersTest()
|
||||
{
|
||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
@ -14,12 +12,13 @@ namespace RetailcrmUnitTest.V3
|
||||
public class PacksTest
|
||||
{
|
||||
private readonly Client _client;
|
||||
private readonly NameValueCollection _appSettings;
|
||||
|
||||
public PacksTest()
|
||||
{
|
||||
_appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"], _appSettings["site"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -79,7 +78,7 @@ namespace RetailcrmUnitTest.V3
|
||||
{
|
||||
{ "purchasePrice", 100 },
|
||||
{ "quantity", 1},
|
||||
{ "store", _appSettings["store"]},
|
||||
{ "store", Environment.GetEnvironmentVariable("RETAILCRM_STORE")},
|
||||
{ "itemId", id[0]}
|
||||
};
|
||||
|
||||
@ -125,7 +124,7 @@ namespace RetailcrmUnitTest.V3
|
||||
{
|
||||
Dictionary<string, object> filter = new Dictionary<string, object>
|
||||
{
|
||||
{ "store", _appSettings["store"]}
|
||||
{ "store", Environment.GetEnvironmentVariable("RETAILCRM_STORE")}
|
||||
};
|
||||
|
||||
Response response = _client.PacksList(filter, 1, 100);
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V3;
|
||||
@ -15,8 +13,10 @@ namespace RetailcrmUnitTest.V3
|
||||
|
||||
public ReferencesTest()
|
||||
{
|
||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
@ -13,12 +11,13 @@ namespace RetailcrmUnitTest.V3
|
||||
public class StoresTest
|
||||
{
|
||||
private readonly Client _client;
|
||||
private readonly NameValueCollection _appSettings;
|
||||
|
||||
public StoresTest()
|
||||
{
|
||||
_appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"], _appSettings["site"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -33,7 +32,7 @@ namespace RetailcrmUnitTest.V3
|
||||
{
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", _appSettings["store"] },
|
||||
{ "code", Environment.GetEnvironmentVariable("RETAILCRM_STORE") },
|
||||
{ "available", 500 },
|
||||
{ "purchasePrice", 300}
|
||||
}
|
||||
@ -47,7 +46,7 @@ namespace RetailcrmUnitTest.V3
|
||||
{
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", _appSettings["store"] },
|
||||
{ "code", Environment.GetEnvironmentVariable("RETAILCRM_STORE") },
|
||||
{ "available", 600 },
|
||||
{ "purchasePrice", 350}
|
||||
}
|
||||
@ -61,7 +60,7 @@ namespace RetailcrmUnitTest.V3
|
||||
{
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", _appSettings["store"] },
|
||||
{ "code", Environment.GetEnvironmentVariable("RETAILCRM_STORE") },
|
||||
{ "available", 700 },
|
||||
{ "purchasePrice", 400}
|
||||
}
|
||||
@ -83,7 +82,7 @@ namespace RetailcrmUnitTest.V3
|
||||
{
|
||||
Dictionary<string, object> filter = new Dictionary<string, object>
|
||||
{
|
||||
{ "site", _appSettings["site"]},
|
||||
{ "site", Environment.GetEnvironmentVariable("RETAILCRM_SITE")},
|
||||
{ "details", 1}
|
||||
};
|
||||
|
||||
@ -121,7 +120,7 @@ namespace RetailcrmUnitTest.V3
|
||||
{
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "code", _appSettings["store"] },
|
||||
{ "code", Environment.GetEnvironmentVariable("RETAILCRM_STORE") },
|
||||
{ "available", 700 },
|
||||
{ "purchasePrice", 400}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
@ -11,18 +10,19 @@ namespace RetailcrmUnitTest.V3
|
||||
public class TelephonyTest
|
||||
{
|
||||
private readonly Client _client;
|
||||
private readonly NameValueCollection _appSettings;
|
||||
|
||||
|
||||
public TelephonyTest()
|
||||
{
|
||||
_appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TelephonyManagerGet()
|
||||
{
|
||||
Response response = _client.TelephonyManagerGet(_appSettings["phone"]);
|
||||
Response response = _client.TelephonyManagerGet("+79999999999");
|
||||
Debug.WriteLine(response.GetRawResponse());
|
||||
Assert.IsTrue(response.IsSuccessfull());
|
||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V4;
|
||||
@ -15,8 +13,10 @@ namespace RetailcrmUnitTest.V4
|
||||
|
||||
public CustomersTest()
|
||||
{
|
||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
@ -15,8 +14,10 @@ namespace RetailcrmUnitTest.V4
|
||||
|
||||
public MarketplaceTest()
|
||||
{
|
||||
var appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
@ -15,8 +13,10 @@ namespace RetailcrmUnitTest.V4
|
||||
|
||||
public OrdersTest()
|
||||
{
|
||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V4;
|
||||
@ -15,8 +13,10 @@ namespace RetailcrmUnitTest.V4
|
||||
|
||||
public ReferencesTest()
|
||||
{
|
||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V4;
|
||||
@ -17,8 +14,10 @@ namespace RetailcrmUnitTest.V4
|
||||
|
||||
public StoresTest()
|
||||
{
|
||||
_appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"], _appSettings["site"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
@ -13,15 +11,16 @@ namespace RetailcrmUnitTest.V4
|
||||
public class TelephonyTest
|
||||
{
|
||||
private readonly Client _client;
|
||||
private readonly NameValueCollection _appSettings;
|
||||
private readonly string _phoneCode = "100";
|
||||
private readonly string _logoUrl = "http://www.onsitemaintenance.com/img/voip.svg";
|
||||
private readonly string _telephonyCode = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||
|
||||
public TelephonyTest()
|
||||
{
|
||||
_appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -32,7 +31,7 @@ namespace RetailcrmUnitTest.V4
|
||||
{
|
||||
|
||||
{ "code", _telephonyCode},
|
||||
{ "clientId", _appSettings["customer"] },
|
||||
{ "clientId", "4717" },
|
||||
{ "makeCallUrl", $"http://{_telephonyCode}.example.com/call"},
|
||||
{ "name", $"TestTelephony-{_telephonyCode}"},
|
||||
{ "image", _logoUrl},
|
||||
@ -45,7 +44,7 @@ namespace RetailcrmUnitTest.V4
|
||||
{
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "userId", _appSettings["manager"] },
|
||||
{ "userId", Environment.GetEnvironmentVariable("RETAILCRM_USER") },
|
||||
{ "code", _phoneCode }
|
||||
}
|
||||
}
|
||||
@ -66,11 +65,11 @@ namespace RetailcrmUnitTest.V4
|
||||
Response response = _client.TelephonyCallEvent(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "phone", _appSettings["phone"] },
|
||||
{ "phone", "+79999999999" },
|
||||
{ "type", "in" },
|
||||
{ "hangupStatus", "failed"},
|
||||
{ "codes", new List<string> { _phoneCode }},
|
||||
{ "userIds", new List<int> { int.Parse(_appSettings["customer"]) }}
|
||||
{ "userIds", new List<int> { int.Parse(Environment.GetEnvironmentVariable("RETAILCRM_USER")) }}
|
||||
}
|
||||
|
||||
);
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
using Retailcrm.Versions.V4;
|
||||
@ -10,12 +9,13 @@ namespace RetailcrmUnitTest.V4
|
||||
public class UsersTest
|
||||
{
|
||||
private readonly Client _client;
|
||||
private readonly NameValueCollection _appSettings;
|
||||
|
||||
public UsersTest()
|
||||
{
|
||||
_appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -31,7 +31,7 @@ namespace RetailcrmUnitTest.V4
|
||||
[TestMethod]
|
||||
public void User()
|
||||
{
|
||||
Response usersGroups = _client.User(int.Parse(_appSettings["manager"]));
|
||||
Response usersGroups = _client.User(int.Parse(Environment.GetEnvironmentVariable("RETAILCRM_USER")));
|
||||
Assert.IsTrue(usersGroups.IsSuccessfull());
|
||||
Assert.IsTrue(usersGroups.GetStatusCode() == 200);
|
||||
Assert.IsInstanceOfType(usersGroups, typeof(Response));
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
@ -15,8 +14,10 @@ namespace RetailcrmUnitTest.V5
|
||||
|
||||
public CostsTest()
|
||||
{
|
||||
var appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
@ -15,8 +14,10 @@ namespace RetailcrmUnitTest.V5
|
||||
|
||||
public CustomFieldsTest()
|
||||
{
|
||||
var appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
@ -15,8 +14,10 @@ namespace RetailcrmUnitTest.V5
|
||||
|
||||
public IntegrationTest()
|
||||
{
|
||||
var appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -29,6 +30,7 @@ namespace RetailcrmUnitTest.V5
|
||||
{
|
||||
{ "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"},
|
||||
|
@ -13,12 +13,13 @@ namespace RetailcrmUnitTest.V5
|
||||
public class NotesTest
|
||||
{
|
||||
private readonly Client _client;
|
||||
private readonly NameValueCollection _appSettings;
|
||||
|
||||
public NotesTest()
|
||||
{
|
||||
_appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -28,8 +29,8 @@ namespace RetailcrmUnitTest.V5
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "text", "test task" },
|
||||
{ "customer", new Dictionary<string, object> { { "id", "2015" } }},
|
||||
{ "managerId", _appSettings["manager"]}
|
||||
{ "customer", new Dictionary<string, object> { { "id", "4717" } }},
|
||||
{ "managerId", Environment.GetEnvironmentVariable("RETAILCRM_USER")}
|
||||
}
|
||||
);
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
@ -16,8 +14,10 @@ namespace RetailcrmUnitTest.V5
|
||||
|
||||
public OrdersTest()
|
||||
{
|
||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
@ -15,8 +14,10 @@ namespace RetailcrmUnitTest.V5
|
||||
|
||||
public PaymentsTest()
|
||||
{
|
||||
var appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
@ -16,8 +14,10 @@ namespace RetailcrmUnitTest.V5
|
||||
|
||||
public ReferencesTest()
|
||||
{
|
||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm;
|
||||
@ -14,8 +13,10 @@ namespace RetailcrmUnitTest.V5
|
||||
|
||||
public SegmentsTest()
|
||||
{
|
||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
@ -13,12 +11,13 @@ namespace RetailcrmUnitTest.V5
|
||||
public class TasksTest
|
||||
{
|
||||
private readonly Client _client;
|
||||
private readonly NameValueCollection _appSettings;
|
||||
|
||||
public TasksTest()
|
||||
{
|
||||
_appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
@ -32,7 +31,7 @@ namespace RetailcrmUnitTest.V5
|
||||
{ "text", "test task" },
|
||||
{ "commentary", "test commentary"},
|
||||
{ "datetime", datetime.AddHours(+3).ToString("yyyy-MM-dd HH:mm")},
|
||||
{ "performerId", _appSettings["manager"]}
|
||||
{ "performerId", Environment.GetEnvironmentVariable("RETAILCRM_USER")}
|
||||
}
|
||||
);
|
||||
|
||||
@ -49,7 +48,7 @@ namespace RetailcrmUnitTest.V5
|
||||
{ "text", "test task edited" },
|
||||
{ "commentary", "test commentary"},
|
||||
{ "datetime", datetime.AddHours(+4).ToString("yyyy-MM-dd HH:mm")},
|
||||
{ "performerId", _appSettings["manager"]}
|
||||
{ "performerId", Environment.GetEnvironmentVariable("RETAILCRM_USER")}
|
||||
}
|
||||
);
|
||||
|
||||
@ -74,7 +73,7 @@ namespace RetailcrmUnitTest.V5
|
||||
Response responseFiltered = _client.TasksList(
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "performers", new List<string> { _appSettings["manager"] } },
|
||||
{ "performers", new List<string> { Environment.GetEnvironmentVariable("RETAILCRM_USER") } },
|
||||
{ "status", "performing" }
|
||||
},
|
||||
2,
|
||||
|
@ -1,7 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Retailcrm.Versions.V5;
|
||||
|
||||
@ -11,12 +9,13 @@ namespace RetailcrmUnitTest.V5
|
||||
public class TelephonyTest
|
||||
{
|
||||
private readonly Client _client;
|
||||
private readonly NameValueCollection _appSettings;
|
||||
|
||||
public TelephonyTest()
|
||||
{
|
||||
_appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Collections.Specialized;
|
||||
using System.Configuration;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
@ -15,8 +14,10 @@ namespace RetailcrmUnitTest.V5
|
||||
|
||||
public UsersTest()
|
||||
{
|
||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
||||
_client = new Client(
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||
);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
|
Loading…
Reference in New Issue
Block a user