mirror of
https://github.com/retailcrm/api-client-dotnet.git
synced 2025-04-09 03:52:01 +00:00
Compare commits
22 commits
Author | SHA1 | Date | |
---|---|---|---|
|
0c784f003c | ||
|
b8794e57ed | ||
|
3b9a6c5f4d | ||
|
f7fb252310 | ||
|
f1aaf3c3d0 | ||
|
e45abd6629 | ||
|
4079e735a8 | ||
|
a82885e85f | ||
|
eec1a09137 | ||
|
e87d93e3a6 | ||
|
572a559422 | ||
|
3e2a958639 | ||
|
b5cbd87afe | ||
|
49a05e744a | ||
|
4b4960b244 | ||
|
cd9fcea5bd | ||
|
c6b1050d04 | ||
|
9243698c67 | ||
|
7489e2af5b | ||
|
2bfeac24e8 | ||
|
7ca29590c8 | ||
|
8ef01ecfb5 |
40 changed files with 362 additions and 192 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -261,5 +261,4 @@ paket-files/
|
||||||
# Python Tools for Visual Studio (PTVS)
|
# Python Tools for Visual Studio (PTVS)
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
*.nuspec
|
|
||||||
*.nupkg
|
*.nupkg
|
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
The MIT License (MIT)
|
The MIT License (MIT)
|
||||||
|
|
||||||
Copyright (c) 2015-2017 RetailDriver LLC
|
Copyright (c) 2015-2020 RetailDriver LLC
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
33
README.md
33
README.md
|
@ -1,19 +1,20 @@
|
||||||
.NET-клиент RetailCRM API
|
[](https://ci.appveyor.com/project/gwinn/api-client-dotnet)
|
||||||
=========================
|
[](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
|
``` bash
|
||||||
PM> Install-Package Retailcrm.SDK
|
PM> Install-Package Retailcrm.SDK
|
||||||
```
|
```
|
||||||
|
|
||||||
Примеры использования
|
## Usage
|
||||||
---------------------
|
|
||||||
|
|
||||||
### Получение информации о заказе
|
### Get order
|
||||||
|
|
||||||
``` csharp
|
``` csharp
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
@ -21,17 +22,17 @@ using Retailcrm;
|
||||||
using Retailcrm.Versions.V5;
|
using Retailcrm.Versions.V5;
|
||||||
...
|
...
|
||||||
|
|
||||||
Client api = new Client("https://demo.retailcrm.ru", "T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH");
|
Client api = new Client("https://demo.retailcrm.pro", "T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH");
|
||||||
Response response = api.OrdersGet("12345", "externalId");
|
Response response = api.OrdersGet("12345", "externalId");
|
||||||
|
|
||||||
if (response.isSuccessful()) {
|
if (response.IsSuccessful()) {
|
||||||
Debug.WriteLine(Response.GetRawResponse());
|
Debug.WriteLine(response.GetRawResponse());
|
||||||
} else {
|
} else {
|
||||||
Debug.WriteLine($"Ошибка: [Статус HTTP-ответа {response.GetStatusCode().ToString()}]");
|
Debug.WriteLine($"Ошибка: [Статус HTTP-ответа {response.GetStatusCode().ToString()}]");
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
### Создание заказа
|
### Create order
|
||||||
|
|
||||||
``` csharp
|
``` csharp
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
@ -39,7 +40,7 @@ using Retailcrm;
|
||||||
using Retailcrm.Versions.V4;
|
using Retailcrm.Versions.V4;
|
||||||
...
|
...
|
||||||
|
|
||||||
Client api = new Client("https://demo.retailcrm.ru", "T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH");
|
Client api = new Client("https://demo.retailcrm.pro", "T9DMPvuNt7FQJMszHUdG8Fkt6xHsqngH");
|
||||||
Response response = api.OrdersCreate(new Dictionary<string, object>
|
Response response = api.OrdersCreate(new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{"externalId", "12345"},
|
{"externalId", "12345"},
|
||||||
|
@ -64,10 +65,10 @@ Response response = api.OrdersCreate(new Dictionary<string, object>
|
||||||
}}
|
}}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (response.isSuccessful()) {
|
if (response.IsSuccessful()) {
|
||||||
Debug.WriteLine(Response.GetResponse()["externalId"].ToString());
|
Debug.WriteLine(response.GetResponse()["externalId"].ToString());
|
||||||
} else {
|
} else {
|
||||||
Debug.WriteLine($"Ошибка: [Статус HTTP-ответа {response.GetStatusCode().ToString()}]");
|
Debug.WriteLine($"Error: [HTTP status code {response.GetStatusCode().ToString()}]");
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("RetailDriver LLC")]
|
[assembly: AssemblyCompany("RetailDriver LLC")]
|
||||||
[assembly: AssemblyProduct("Retailcrm.SDK")]
|
[assembly: AssemblyProduct("Retailcrm.SDK")]
|
||||||
[assembly: AssemblyCopyright("Copyright © RetailDriver LLC 2017")]
|
[assembly: AssemblyCopyright("Copyright © RetailDriver LLC 2020")]
|
||||||
[assembly: AssemblyTrademark("RetailDriver LLC")]
|
[assembly: AssemblyTrademark("RetailDriver LLC")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
namespace Retailcrm
|
namespace Retailcrm
|
||||||
{
|
{
|
||||||
|
@ -37,8 +38,8 @@ namespace Retailcrm
|
||||||
return String.Join(argSeperator,
|
return String.Join(argSeperator,
|
||||||
_keyValuePairs.Select(kvp =>
|
_keyValuePairs.Select(kvp =>
|
||||||
{
|
{
|
||||||
var key = Uri.EscapeDataString(kvp.Key);
|
var key = HttpUtility.UrlEncode(kvp.Key);
|
||||||
var value = Uri.EscapeDataString(kvp.Value.ToString());
|
var value = HttpUtility.UrlEncode(kvp.Value.ToString());
|
||||||
return $"{key}={value}";
|
return $"{key}={value}";
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -51,10 +52,9 @@ namespace Retailcrm
|
||||||
/// <param name="allowObjects"></param>
|
/// <param name="allowObjects"></param>
|
||||||
private void AddEntry(string prefix, object instance, bool allowObjects)
|
private void AddEntry(string prefix, object instance, bool allowObjects)
|
||||||
{
|
{
|
||||||
var dictionary = instance as IDictionary;
|
|
||||||
var collection = instance as ICollection;
|
var collection = instance as ICollection;
|
||||||
|
|
||||||
if (dictionary != null)
|
if (instance is IDictionary dictionary)
|
||||||
{
|
{
|
||||||
Add(prefix, GetDictionaryAdapter(dictionary));
|
Add(prefix, GetDictionaryAdapter(dictionary));
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ namespace Retailcrm
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="data"></param>
|
/// <param name="data"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private IEnumerable<Entry> GetObjectAdapter(object data)
|
private static IEnumerable<Entry> GetObjectAdapter(object data)
|
||||||
{
|
{
|
||||||
var properties = data.GetType().GetProperties();
|
var properties = data.GetType().GetProperties();
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ namespace Retailcrm
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="collection"></param>
|
/// <param name="collection"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private IEnumerable<Entry> GetArrayAdapter(ICollection collection)
|
private static IEnumerable<Entry> GetArrayAdapter(ICollection collection)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (var item in collection)
|
foreach (var item in collection)
|
||||||
|
@ -141,7 +141,7 @@ namespace Retailcrm
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="collection"></param>
|
/// <param name="collection"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private IEnumerable<Entry> GetDictionaryAdapter(IDictionary collection)
|
private static IEnumerable<Entry> GetDictionaryAdapter(IDictionary collection)
|
||||||
{
|
{
|
||||||
foreach (DictionaryEntry item in collection)
|
foreach (DictionaryEntry item in collection)
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,7 +77,6 @@ namespace Retailcrm
|
||||||
}
|
}
|
||||||
|
|
||||||
Exception exception = null;
|
Exception exception = null;
|
||||||
|
|
||||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(path);
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(path);
|
||||||
request.Method = method;
|
request.Method = method;
|
||||||
|
|
||||||
|
@ -112,7 +111,6 @@ namespace Retailcrm
|
||||||
throw new WebException(exception.ToString(), exception);
|
throw new WebException(exception.ToString(), exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper disable once AssignNullToNotNullAttribute
|
|
||||||
StreamReader reader = new StreamReader(response.GetResponseStream());
|
StreamReader reader = new StreamReader(response.GetResponseStream());
|
||||||
string responseBody = reader.ReadToEnd();
|
string responseBody = reader.ReadToEnd();
|
||||||
int statusCode = (int)response.StatusCode;
|
int statusCode = (int)response.StatusCode;
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Runtime.Serialization" />
|
<Reference Include="System.Runtime.Serialization" />
|
||||||
|
<Reference Include="System.Web" />
|
||||||
<Reference Include="System.Web.Extensions" />
|
<Reference Include="System.Web.Extensions" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
|
|
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.3</version>
|
||||||
|
<title>$title$</title>
|
||||||
|
<authors>RetailCRM</authors>
|
||||||
|
<owners>RetailCRM</owners>
|
||||||
|
<license type="expression">MIT</license>
|
||||||
|
<projectUrl>https://github.com/retailcrmapi-client-dotnet</projectUrl>
|
||||||
|
<iconUrl>https://s3-s1.retailcrm.tech/eu-central-1/retailcrm-static/branding/retailcrm/favicon/favicon.ico</iconUrl>
|
||||||
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
|
<description>Multiversion API client for RetailCRM</description>
|
||||||
|
<releaseNotes>Rebranding</releaseNotes>
|
||||||
|
<copyright>Copyright 2017-2020</copyright>
|
||||||
|
<tags>crm ecommerce retailcrm sdk</tags>
|
||||||
|
</metadata>
|
||||||
|
</package>
|
|
@ -154,6 +154,10 @@ namespace Retailcrm.Versions.V5
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Couriers list
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
public Response Couriers()
|
public Response Couriers()
|
||||||
{
|
{
|
||||||
return Request.MakeRequest(
|
return Request.MakeRequest(
|
||||||
|
@ -162,6 +166,11 @@ namespace Retailcrm.Versions.V5
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a courier
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="courier"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public Response CouriersCreate(Dictionary<string, object> courier)
|
public Response CouriersCreate(Dictionary<string, object> courier)
|
||||||
{
|
{
|
||||||
return Request.MakeRequest(
|
return Request.MakeRequest(
|
||||||
|
@ -174,6 +183,11 @@ namespace Retailcrm.Versions.V5
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Edit a courier
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="courier"></param>
|
||||||
|
/// <returns></returns>
|
||||||
public Response CouriersEdit(Dictionary<string, object> courier)
|
public Response CouriersEdit(Dictionary<string, object> courier)
|
||||||
{
|
{
|
||||||
if (!courier.ContainsKey("id"))
|
if (!courier.ContainsKey("id"))
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System.Collections.Specialized;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using System.Configuration;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
|
|
||||||
namespace RetailcrmUnitTest
|
namespace RetailcrmUnitTest
|
||||||
|
@ -12,8 +10,10 @@ namespace RetailcrmUnitTest
|
||||||
|
|
||||||
public ApiTest()
|
public ApiTest()
|
||||||
{
|
{
|
||||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
_connection = new Connection(
|
||||||
_connection = new Connection(appSettings["apiUrl"], appSettings["apiKey"]);
|
System.Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
System.Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[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>
|
|
|
@ -2,12 +2,12 @@ using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
[assembly: AssemblyTitle("RetailcrmUnitTest")]
|
[assembly: AssemblyTitle("RetailcrmUnitTest")]
|
||||||
[assembly: AssemblyDescription("")]
|
[assembly: AssemblyDescription("Tests for RetailCRM SDK")]
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("")]
|
[assembly: AssemblyCompany("RetailDriver LLC")]
|
||||||
[assembly: AssemblyProduct("RetailcrmUnitTest")]
|
[assembly: AssemblyProduct("RetailcrmUnitTest")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2017")]
|
[assembly: AssemblyCopyright("Copyright © RetailDriver LLC 2020")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("RetailDriver LLC")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.props')" />
|
<Import Project="..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
|
@ -39,10 +39,10 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
<HintPath>..\packages\MSTest.TestFramework.2.1.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\MSTest.TestFramework.1.1.18\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
<HintPath>..\packages\MSTest.TestFramework.2.1.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
<Reference Include="System.Configuration" />
|
||||||
|
@ -80,27 +80,23 @@
|
||||||
<Compile Include="V5\ReferencesTest.cs" />
|
<Compile Include="V5\ReferencesTest.cs" />
|
||||||
<Compile Include="V5\SegmentsTest.cs" />
|
<Compile Include="V5\SegmentsTest.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<None Include="App.config" />
|
|
||||||
<None Include="App.config.dist" />
|
|
||||||
<None Include="packages.config">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Retailcrm\Retailcrm.csproj">
|
<ProjectReference Include="..\Retailcrm\Retailcrm.csproj">
|
||||||
<Project>{9c378ef4-9f9b-4214-a9aa-1fc3c44edb41}</Project>
|
<Project>{9c378ef4-9f9b-4214-a9aa-1fc3c44edb41}</Project>
|
||||||
<Name>Retailcrm</Name>
|
<Name>Retailcrm</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="packages.config" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
|
<ErrorText>Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.props'))" />
|
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.props'))" />
|
||||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.targets'))" />
|
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
<Import Project="..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.1.18\build\net45\MSTest.TestAdapter.targets')" />
|
<Import Project="..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.0\build\net45\MSTest.TestAdapter.targets')" />
|
||||||
</Project>
|
</Project>
|
|
@ -1,6 +1,4 @@
|
||||||
using System.Collections.Specialized;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using System.Configuration;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
using Retailcrm.Versions.V3;
|
using Retailcrm.Versions.V3;
|
||||||
|
|
||||||
|
@ -13,8 +11,10 @@ namespace RetailcrmUnitTest.V3
|
||||||
|
|
||||||
public ClientTest()
|
public ClientTest()
|
||||||
{
|
{
|
||||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"], appSettings["site"]);
|
System.Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
System.Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Configuration;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
using Retailcrm.Versions.V3;
|
using Retailcrm.Versions.V3;
|
||||||
|
@ -12,12 +10,13 @@ namespace RetailcrmUnitTest.V3
|
||||||
public class CustomersTest
|
public class CustomersTest
|
||||||
{
|
{
|
||||||
private readonly Client _client;
|
private readonly Client _client;
|
||||||
private readonly NameValueCollection _appSettings;
|
|
||||||
|
|
||||||
public CustomersTest()
|
public CustomersTest()
|
||||||
{
|
{
|
||||||
_appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
@ -102,7 +101,7 @@ namespace RetailcrmUnitTest.V3
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void CustomersList()
|
public void CustomersList()
|
||||||
{
|
{
|
||||||
_client.SetSite(_appSettings["site"]);
|
_client.SetSite(Environment.GetEnvironmentVariable("RETAILCRM_SITE"));
|
||||||
|
|
||||||
Response response = _client.CustomersList();
|
Response response = _client.CustomersList();
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Configuration;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
using Retailcrm.Versions.V3;
|
using Retailcrm.Versions.V3;
|
||||||
|
@ -15,8 +13,10 @@ namespace RetailcrmUnitTest.V3
|
||||||
|
|
||||||
public OrdersTest()
|
public OrdersTest()
|
||||||
{
|
{
|
||||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Diagnostics;
|
||||||
using System.Configuration;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
@ -14,15 +13,17 @@ namespace RetailcrmUnitTest.V3
|
||||||
public class PacksTest
|
public class PacksTest
|
||||||
{
|
{
|
||||||
private readonly Client _client;
|
private readonly Client _client;
|
||||||
private readonly NameValueCollection _appSettings;
|
|
||||||
|
|
||||||
public PacksTest()
|
public PacksTest()
|
||||||
{
|
{
|
||||||
_appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"], _appSettings["site"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
[Ignore]
|
||||||
public void PacksCreateUpdateReadDelete()
|
public void PacksCreateUpdateReadDelete()
|
||||||
{
|
{
|
||||||
string uid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 12);
|
string uid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 12);
|
||||||
|
@ -70,8 +71,7 @@ namespace RetailcrmUnitTest.V3
|
||||||
|
|
||||||
foreach (Dictionary<string, object> s in arr.OfType<Dictionary<string, object>>())
|
foreach (Dictionary<string, object> s in arr.OfType<Dictionary<string, object>>())
|
||||||
{
|
{
|
||||||
int itemId;
|
int.TryParse(s["id"].ToString(), NumberStyles.Any, null, out int itemId);
|
||||||
int.TryParse(s["id"].ToString(), NumberStyles.Any, null, out itemId);
|
|
||||||
id[0] = itemId;
|
id[0] = itemId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,12 +79,13 @@ namespace RetailcrmUnitTest.V3
|
||||||
{
|
{
|
||||||
{ "purchasePrice", 100 },
|
{ "purchasePrice", 100 },
|
||||||
{ "quantity", 1},
|
{ "quantity", 1},
|
||||||
{ "store", _appSettings["store"]},
|
{ "store", Environment.GetEnvironmentVariable("RETAILCRM_STORE")},
|
||||||
{ "itemId", id[0]}
|
{ "itemId", id[0]}
|
||||||
};
|
};
|
||||||
|
|
||||||
Response packsCreateResponse = _client.PacksCreate(pack);
|
Response packsCreateResponse = _client.PacksCreate(pack);
|
||||||
|
|
||||||
|
Debug.WriteLine(packsCreateResponse.GetRawResponse());
|
||||||
Assert.IsTrue(packsCreateResponse.IsSuccessfull());
|
Assert.IsTrue(packsCreateResponse.IsSuccessfull());
|
||||||
Assert.IsTrue(packsCreateResponse.GetStatusCode() == 201);
|
Assert.IsTrue(packsCreateResponse.GetStatusCode() == 201);
|
||||||
Assert.IsInstanceOfType(packsCreateResponse, typeof(Response));
|
Assert.IsInstanceOfType(packsCreateResponse, typeof(Response));
|
||||||
|
@ -125,7 +126,7 @@ namespace RetailcrmUnitTest.V3
|
||||||
{
|
{
|
||||||
Dictionary<string, object> filter = new Dictionary<string, object>
|
Dictionary<string, object> filter = new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{ "store", _appSettings["store"]}
|
{ "store", Environment.GetEnvironmentVariable("RETAILCRM_STORE")}
|
||||||
};
|
};
|
||||||
|
|
||||||
Response response = _client.PacksList(filter, 1, 100);
|
Response response = _client.PacksList(filter, 1, 100);
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Configuration;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
using Retailcrm.Versions.V3;
|
using Retailcrm.Versions.V3;
|
||||||
|
@ -15,8 +13,10 @@ namespace RetailcrmUnitTest.V3
|
||||||
|
|
||||||
public ReferencesTest()
|
public ReferencesTest()
|
||||||
{
|
{
|
||||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
|
@ -13,12 +11,13 @@ namespace RetailcrmUnitTest.V3
|
||||||
public class StoresTest
|
public class StoresTest
|
||||||
{
|
{
|
||||||
private readonly Client _client;
|
private readonly Client _client;
|
||||||
private readonly NameValueCollection _appSettings;
|
|
||||||
|
|
||||||
public StoresTest()
|
public StoresTest()
|
||||||
{
|
{
|
||||||
_appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"], _appSettings["site"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
@ -33,7 +32,7 @@ namespace RetailcrmUnitTest.V3
|
||||||
{
|
{
|
||||||
new Dictionary<string, object>
|
new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{ "code", _appSettings["store"] },
|
{ "code", Environment.GetEnvironmentVariable("RETAILCRM_STORE") },
|
||||||
{ "available", 500 },
|
{ "available", 500 },
|
||||||
{ "purchasePrice", 300}
|
{ "purchasePrice", 300}
|
||||||
}
|
}
|
||||||
|
@ -47,7 +46,7 @@ namespace RetailcrmUnitTest.V3
|
||||||
{
|
{
|
||||||
new Dictionary<string, object>
|
new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{ "code", _appSettings["store"] },
|
{ "code", Environment.GetEnvironmentVariable("RETAILCRM_STORE") },
|
||||||
{ "available", 600 },
|
{ "available", 600 },
|
||||||
{ "purchasePrice", 350}
|
{ "purchasePrice", 350}
|
||||||
}
|
}
|
||||||
|
@ -61,7 +60,7 @@ namespace RetailcrmUnitTest.V3
|
||||||
{
|
{
|
||||||
new Dictionary<string, object>
|
new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{ "code", _appSettings["store"] },
|
{ "code", Environment.GetEnvironmentVariable("RETAILCRM_STORE") },
|
||||||
{ "available", 700 },
|
{ "available", 700 },
|
||||||
{ "purchasePrice", 400}
|
{ "purchasePrice", 400}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +82,7 @@ namespace RetailcrmUnitTest.V3
|
||||||
{
|
{
|
||||||
Dictionary<string, object> filter = new Dictionary<string, object>
|
Dictionary<string, object> filter = new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{ "site", _appSettings["site"]},
|
{ "site", Environment.GetEnvironmentVariable("RETAILCRM_SITE")},
|
||||||
{ "details", 1}
|
{ "details", 1}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -121,7 +120,7 @@ namespace RetailcrmUnitTest.V3
|
||||||
{
|
{
|
||||||
new Dictionary<string, object>
|
new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{ "code", _appSettings["store"] },
|
{ "code", Environment.GetEnvironmentVariable("RETAILCRM_STORE") },
|
||||||
{ "available", 700 },
|
{ "available", 700 },
|
||||||
{ "purchasePrice", 400}
|
{ "purchasePrice", 400}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Collections.Specialized;
|
using System;
|
||||||
using System.Configuration;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
|
@ -11,18 +10,20 @@ namespace RetailcrmUnitTest.V3
|
||||||
public class TelephonyTest
|
public class TelephonyTest
|
||||||
{
|
{
|
||||||
private readonly Client _client;
|
private readonly Client _client;
|
||||||
private readonly NameValueCollection _appSettings;
|
|
||||||
|
|
||||||
public TelephonyTest()
|
public TelephonyTest()
|
||||||
{
|
{
|
||||||
_appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
[Ignore]
|
||||||
public void TelephonyManagerGet()
|
public void TelephonyManagerGet()
|
||||||
{
|
{
|
||||||
Response response = _client.TelephonyManagerGet(_appSettings["phone"]);
|
Response response = _client.TelephonyManagerGet("+79999999999");
|
||||||
Debug.WriteLine(response.GetRawResponse());
|
Debug.WriteLine(response.GetRawResponse());
|
||||||
Assert.IsTrue(response.IsSuccessfull());
|
Assert.IsTrue(response.IsSuccessfull());
|
||||||
Assert.IsTrue(response.GetStatusCode() == 200);
|
Assert.IsTrue(response.GetStatusCode() == 200);
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Configuration;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
using Retailcrm.Versions.V4;
|
using Retailcrm.Versions.V4;
|
||||||
|
@ -15,8 +13,10 @@ namespace RetailcrmUnitTest.V4
|
||||||
|
|
||||||
public CustomersTest()
|
public CustomersTest()
|
||||||
{
|
{
|
||||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
|
@ -15,8 +14,10 @@ namespace RetailcrmUnitTest.V4
|
||||||
|
|
||||||
public MarketplaceTest()
|
public MarketplaceTest()
|
||||||
{
|
{
|
||||||
var appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
|
@ -15,8 +13,10 @@ namespace RetailcrmUnitTest.V4
|
||||||
|
|
||||||
public OrdersTest()
|
public OrdersTest()
|
||||||
{
|
{
|
||||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
@ -37,5 +37,113 @@ namespace RetailcrmUnitTest.V4
|
||||||
Assert.IsInstanceOfType(response, typeof(Response));
|
Assert.IsInstanceOfType(response, typeof(Response));
|
||||||
Assert.IsTrue(response.GetResponse().ContainsKey("history"));
|
Assert.IsTrue(response.GetResponse().ContainsKey("history"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestMethod]
|
||||||
|
public void BigOrderCreateUpdate()
|
||||||
|
{
|
||||||
|
long epochTicks = new DateTime(1970, 1, 1).Ticks;
|
||||||
|
long unixTime = ((DateTime.UtcNow.Ticks - epochTicks) / TimeSpan.TicksPerSecond);
|
||||||
|
|
||||||
|
List<Dictionary<string, object>> items = new List<Dictionary<string, object>>();
|
||||||
|
Dictionary<string, object> properties = new Dictionary<string, object>();
|
||||||
|
|
||||||
|
for (int j = 0; j < 10; j++)
|
||||||
|
{
|
||||||
|
properties.Add(
|
||||||
|
$"property_{j}",
|
||||||
|
new Dictionary<string, object> {
|
||||||
|
{ "name", $"Property_{j}" },
|
||||||
|
{ "code", $"property_{j}" },
|
||||||
|
{ "value", $"{Guid.NewGuid().ToString()}" },
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 100; i++) {
|
||||||
|
Dictionary<string, object> item = new Dictionary<string, object> {
|
||||||
|
{ "initialPrice", i + 100 },
|
||||||
|
{ "purchasePrice", i + 90 },
|
||||||
|
{ "productName", $"Product_{i}" },
|
||||||
|
{ "quantity", 2 },
|
||||||
|
{
|
||||||
|
"offer",
|
||||||
|
new Dictionary<string, object> {
|
||||||
|
{ "name", $"Product_{i}" },
|
||||||
|
{ "xmlId", $"{Guid.NewGuid().ToString()}" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ "properties", properties }
|
||||||
|
};
|
||||||
|
|
||||||
|
items.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
Dictionary<string, object> order = new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
{"number", unixTime},
|
||||||
|
{"createdAt", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")},
|
||||||
|
{"lastName", "Doe"},
|
||||||
|
{"firstName", "John"},
|
||||||
|
{"email", "john@example.com"},
|
||||||
|
{"phone", "+79999999999"},
|
||||||
|
{"items", items},
|
||||||
|
{
|
||||||
|
"delivery",
|
||||||
|
new Dictionary<string, object> {
|
||||||
|
{ "code", "self-delivery" },
|
||||||
|
{ "cost", "300" },
|
||||||
|
{
|
||||||
|
"address", new Dictionary<string, object> {
|
||||||
|
{ "city", "Москва" },
|
||||||
|
{ "street", "Ярославская" },
|
||||||
|
{ "building", "10" },
|
||||||
|
{ "flat", "2" },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Response createResponse = _client.OrdersCreate(order);
|
||||||
|
|
||||||
|
Assert.IsTrue(createResponse.IsSuccessfull());
|
||||||
|
Assert.IsInstanceOfType(createResponse, typeof(Response));
|
||||||
|
Assert.AreEqual(createResponse.GetStatusCode(), 201);
|
||||||
|
Assert.IsTrue(createResponse.GetResponse().ContainsKey("id"));
|
||||||
|
|
||||||
|
List<Dictionary<string, object>> newItems = new List<Dictionary<string, object>>();
|
||||||
|
|
||||||
|
for (int i = 0; i < 120; i++)
|
||||||
|
{
|
||||||
|
Dictionary<string, object> item = new Dictionary<string, object> {
|
||||||
|
{ "initialPrice", i + 100 },
|
||||||
|
{ "purchasePrice", i + 90 },
|
||||||
|
{ "productName", $"Product_{i}" },
|
||||||
|
{ "quantity", 2 },
|
||||||
|
{
|
||||||
|
"offer",
|
||||||
|
new Dictionary<string, object> {
|
||||||
|
{ "name", $"Product_{i}" },
|
||||||
|
{ "xmlId", $"{Guid.NewGuid().ToString()}" }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ "properties", properties }
|
||||||
|
};
|
||||||
|
|
||||||
|
newItems.Add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
Response updateResponse = _client.OrdersUpdate(
|
||||||
|
new Dictionary<string, object> {
|
||||||
|
{ "id", createResponse.GetResponse()["id"].ToString()},
|
||||||
|
{ "items", newItems }
|
||||||
|
},
|
||||||
|
"id"
|
||||||
|
);
|
||||||
|
|
||||||
|
Assert.IsTrue(updateResponse.IsSuccessfull());
|
||||||
|
Assert.IsInstanceOfType(updateResponse, typeof(Response));
|
||||||
|
Assert.AreEqual(updateResponse.GetStatusCode(), 200);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Configuration;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
using Retailcrm.Versions.V4;
|
using Retailcrm.Versions.V4;
|
||||||
|
@ -15,8 +13,10 @@ namespace RetailcrmUnitTest.V4
|
||||||
|
|
||||||
public ReferencesTest()
|
public ReferencesTest()
|
||||||
{
|
{
|
||||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
using Retailcrm.Versions.V4;
|
using Retailcrm.Versions.V4;
|
||||||
|
@ -13,12 +9,13 @@ namespace RetailcrmUnitTest.V4
|
||||||
public class StoresTest
|
public class StoresTest
|
||||||
{
|
{
|
||||||
private readonly Client _client;
|
private readonly Client _client;
|
||||||
private readonly NameValueCollection _appSettings;
|
|
||||||
|
|
||||||
public StoresTest()
|
public StoresTest()
|
||||||
{
|
{
|
||||||
_appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"], _appSettings["site"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
|
@ -13,15 +11,16 @@ namespace RetailcrmUnitTest.V4
|
||||||
public class TelephonyTest
|
public class TelephonyTest
|
||||||
{
|
{
|
||||||
private readonly Client _client;
|
private readonly Client _client;
|
||||||
private readonly NameValueCollection _appSettings;
|
|
||||||
private readonly string _phoneCode = "100";
|
private readonly string _phoneCode = "100";
|
||||||
private readonly string _logoUrl = "http://www.onsitemaintenance.com/img/voip.svg";
|
private readonly string _logoUrl = "http://www.onsitemaintenance.com/img/voip.svg";
|
||||||
private readonly string _telephonyCode = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
private readonly string _telephonyCode = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 6);
|
||||||
|
|
||||||
public TelephonyTest()
|
public TelephonyTest()
|
||||||
{
|
{
|
||||||
_appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
@ -32,7 +31,7 @@ namespace RetailcrmUnitTest.V4
|
||||||
{
|
{
|
||||||
|
|
||||||
{ "code", _telephonyCode},
|
{ "code", _telephonyCode},
|
||||||
{ "clientId", _appSettings["customer"] },
|
{ "clientId", "4717" },
|
||||||
{ "makeCallUrl", $"http://{_telephonyCode}.example.com/call"},
|
{ "makeCallUrl", $"http://{_telephonyCode}.example.com/call"},
|
||||||
{ "name", $"TestTelephony-{_telephonyCode}"},
|
{ "name", $"TestTelephony-{_telephonyCode}"},
|
||||||
{ "image", _logoUrl},
|
{ "image", _logoUrl},
|
||||||
|
@ -45,7 +44,7 @@ namespace RetailcrmUnitTest.V4
|
||||||
{
|
{
|
||||||
new Dictionary<string, object>
|
new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{ "userId", _appSettings["manager"] },
|
{ "userId", Environment.GetEnvironmentVariable("RETAILCRM_USER") },
|
||||||
{ "code", _phoneCode }
|
{ "code", _phoneCode }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,16 +60,17 @@ namespace RetailcrmUnitTest.V4
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
[Ignore]
|
||||||
public void TelephonyCallEvent()
|
public void TelephonyCallEvent()
|
||||||
{
|
{
|
||||||
Response response = _client.TelephonyCallEvent(
|
Response response = _client.TelephonyCallEvent(
|
||||||
new Dictionary<string, object>
|
new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{ "phone", _appSettings["phone"] },
|
{ "phone", "+79999999999" },
|
||||||
{ "type", "in" },
|
{ "type", "in" },
|
||||||
{ "hangupStatus", "failed"},
|
{ "hangupStatus", "failed"},
|
||||||
{ "codes", new List<string> { _phoneCode }},
|
{ "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;
|
||||||
using System.Configuration;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
using Retailcrm.Versions.V4;
|
using Retailcrm.Versions.V4;
|
||||||
|
@ -10,12 +9,13 @@ namespace RetailcrmUnitTest.V4
|
||||||
public class UsersTest
|
public class UsersTest
|
||||||
{
|
{
|
||||||
private readonly Client _client;
|
private readonly Client _client;
|
||||||
private readonly NameValueCollection _appSettings;
|
|
||||||
|
|
||||||
public UsersTest()
|
public UsersTest()
|
||||||
{
|
{
|
||||||
_appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
@ -31,7 +31,7 @@ namespace RetailcrmUnitTest.V4
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void User()
|
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.IsSuccessfull());
|
||||||
Assert.IsTrue(usersGroups.GetStatusCode() == 200);
|
Assert.IsTrue(usersGroups.GetStatusCode() == 200);
|
||||||
Assert.IsInstanceOfType(usersGroups, typeof(Response));
|
Assert.IsInstanceOfType(usersGroups, typeof(Response));
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Configuration;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
@ -15,8 +14,10 @@ namespace RetailcrmUnitTest.V5
|
||||||
|
|
||||||
public CostsTest()
|
public CostsTest()
|
||||||
{
|
{
|
||||||
var appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Configuration;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
@ -15,8 +14,10 @@ namespace RetailcrmUnitTest.V5
|
||||||
|
|
||||||
public CustomFieldsTest()
|
public CustomFieldsTest()
|
||||||
{
|
{
|
||||||
var appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
|
@ -15,8 +14,10 @@ namespace RetailcrmUnitTest.V5
|
||||||
|
|
||||||
public IntegrationTest()
|
public IntegrationTest()
|
||||||
{
|
{
|
||||||
var appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
@ -29,6 +30,7 @@ namespace RetailcrmUnitTest.V5
|
||||||
{
|
{
|
||||||
{ "code", uid},
|
{ "code", uid},
|
||||||
{ "name", $"TestIntegration-{uid}"},
|
{ "name", $"TestIntegration-{uid}"},
|
||||||
|
{ "clientId", uid},
|
||||||
{ "active", true},
|
{ "active", true},
|
||||||
{ "accountUrl", $"http://{uid}.example.com"},
|
{ "accountUrl", $"http://{uid}.example.com"},
|
||||||
{ "logo", "https://www.ibm.com/cloud-computing/images/cloud/products/cloud-integration/api-economy-icon.svg"},
|
{ "logo", "https://www.ibm.com/cloud-computing/images/cloud/products/cloud-integration/api-economy-icon.svg"},
|
||||||
|
|
|
@ -13,23 +13,42 @@ namespace RetailcrmUnitTest.V5
|
||||||
public class NotesTest
|
public class NotesTest
|
||||||
{
|
{
|
||||||
private readonly Client _client;
|
private readonly Client _client;
|
||||||
private readonly NameValueCollection _appSettings;
|
|
||||||
|
|
||||||
public NotesTest()
|
public NotesTest()
|
||||||
{
|
{
|
||||||
_appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
public void NotesCreateDelete()
|
public void NotesCreateDelete()
|
||||||
{
|
{
|
||||||
|
Dictionary<string, object> customer = new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
{"externalId", Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 12)},
|
||||||
|
{"lastName", "Took"},
|
||||||
|
{"firstName", "Peregrin"},
|
||||||
|
{"email", "took@example.com"},
|
||||||
|
{"phone", "+78888888989"}
|
||||||
|
};
|
||||||
|
|
||||||
|
Response createResponse = _client.CustomersCreate(customer);
|
||||||
|
|
||||||
|
Assert.IsTrue(createResponse.IsSuccessfull());
|
||||||
|
Assert.IsInstanceOfType(createResponse, typeof(Response));
|
||||||
|
Assert.IsTrue(createResponse.GetStatusCode() == 201);
|
||||||
|
Assert.IsTrue(createResponse.GetResponse().ContainsKey("id"));
|
||||||
|
|
||||||
|
string id = createResponse.GetResponse()["id"].ToString();
|
||||||
|
|
||||||
Response responseFiltered = _client.NotesCreate(
|
Response responseFiltered = _client.NotesCreate(
|
||||||
new Dictionary<string, object>
|
new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{ "text", "test task" },
|
{ "text", "test task" },
|
||||||
{ "customer", new Dictionary<string, object> { { "id", "2015" } }},
|
{ "customer", new Dictionary<string, object> { { "id", id } }},
|
||||||
{ "managerId", _appSettings["manager"]}
|
{ "managerId", Environment.GetEnvironmentVariable("RETAILCRM_USER")}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
@ -16,8 +14,10 @@ namespace RetailcrmUnitTest.V5
|
||||||
|
|
||||||
public OrdersTest()
|
public OrdersTest()
|
||||||
{
|
{
|
||||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Configuration;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
@ -15,8 +14,10 @@ namespace RetailcrmUnitTest.V5
|
||||||
|
|
||||||
public PaymentsTest()
|
public PaymentsTest()
|
||||||
{
|
{
|
||||||
var appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
|
@ -16,8 +14,10 @@ namespace RetailcrmUnitTest.V5
|
||||||
|
|
||||||
public ReferencesTest()
|
public ReferencesTest()
|
||||||
{
|
{
|
||||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Collections.Specialized;
|
using System;
|
||||||
using System.Configuration;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm;
|
using Retailcrm;
|
||||||
|
@ -14,8 +13,10 @@ namespace RetailcrmUnitTest.V5
|
||||||
|
|
||||||
public SegmentsTest()
|
public SegmentsTest()
|
||||||
{
|
{
|
||||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
@ -13,15 +11,17 @@ namespace RetailcrmUnitTest.V5
|
||||||
public class TasksTest
|
public class TasksTest
|
||||||
{
|
{
|
||||||
private readonly Client _client;
|
private readonly Client _client;
|
||||||
private readonly NameValueCollection _appSettings;
|
|
||||||
|
|
||||||
public TasksTest()
|
public TasksTest()
|
||||||
{
|
{
|
||||||
_appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
[Ignore]
|
||||||
public void TasksCreateUpdateGet()
|
public void TasksCreateUpdateGet()
|
||||||
{
|
{
|
||||||
DateTime datetime = DateTime.Now;
|
DateTime datetime = DateTime.Now;
|
||||||
|
@ -32,7 +32,7 @@ namespace RetailcrmUnitTest.V5
|
||||||
{ "text", "test task" },
|
{ "text", "test task" },
|
||||||
{ "commentary", "test commentary"},
|
{ "commentary", "test commentary"},
|
||||||
{ "datetime", datetime.AddHours(+3).ToString("yyyy-MM-dd HH:mm")},
|
{ "datetime", datetime.AddHours(+3).ToString("yyyy-MM-dd HH:mm")},
|
||||||
{ "performerId", _appSettings["manager"]}
|
{ "performerId", Environment.GetEnvironmentVariable("RETAILCRM_USER")}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ namespace RetailcrmUnitTest.V5
|
||||||
{ "text", "test task edited" },
|
{ "text", "test task edited" },
|
||||||
{ "commentary", "test commentary"},
|
{ "commentary", "test commentary"},
|
||||||
{ "datetime", datetime.AddHours(+4).ToString("yyyy-MM-dd HH:mm")},
|
{ "datetime", datetime.AddHours(+4).ToString("yyyy-MM-dd HH:mm")},
|
||||||
{ "performerId", _appSettings["manager"]}
|
{ "performerId", Environment.GetEnvironmentVariable("RETAILCRM_USER")}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ namespace RetailcrmUnitTest.V5
|
||||||
Response responseFiltered = _client.TasksList(
|
Response responseFiltered = _client.TasksList(
|
||||||
new Dictionary<string, object>
|
new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{ "performers", new List<string> { _appSettings["manager"] } },
|
{ "performers", new List<string> { Environment.GetEnvironmentVariable("RETAILCRM_USER") } },
|
||||||
{ "status", "performing" }
|
{ "status", "performing" }
|
||||||
},
|
},
|
||||||
2,
|
2,
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Configuration;
|
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
using Retailcrm.Versions.V5;
|
using Retailcrm.Versions.V5;
|
||||||
|
|
||||||
|
@ -11,12 +9,13 @@ namespace RetailcrmUnitTest.V5
|
||||||
public class TelephonyTest
|
public class TelephonyTest
|
||||||
{
|
{
|
||||||
private readonly Client _client;
|
private readonly Client _client;
|
||||||
private readonly NameValueCollection _appSettings;
|
|
||||||
|
|
||||||
public TelephonyTest()
|
public TelephonyTest()
|
||||||
{
|
{
|
||||||
_appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(_appSettings["apiUrl"], _appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Collections.Specialized;
|
using System;
|
||||||
using System.Configuration;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||||
|
@ -15,8 +14,10 @@ namespace RetailcrmUnitTest.V5
|
||||||
|
|
||||||
public UsersTest()
|
public UsersTest()
|
||||||
{
|
{
|
||||||
NameValueCollection appSettings = ConfigurationManager.AppSettings;
|
_client = new Client(
|
||||||
_client = new Client(appSettings["apiUrl"], appSettings["apiKey"]);
|
Environment.GetEnvironmentVariable("RETAILCRM_URL"),
|
||||||
|
Environment.GetEnvironmentVariable("RETAILCRM_KEY")
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
[TestMethod]
|
[TestMethod]
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
<package id="MSTest.TestAdapter" version="1.1.18" targetFramework="net45" />
|
<package id="MSTest.TestAdapter" version="2.1.0" targetFramework="net45" />
|
||||||
<package id="MSTest.TestFramework" version="1.1.18" targetFramework="net45" />
|
<package id="MSTest.TestFramework" version="2.1.0" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
24
appveyor.yml
Normal file
24
appveyor.yml
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
version: 5.1.{build}
|
||||||
|
pull_requests:
|
||||||
|
do_not_increment_build_number: true
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
skip_tags: true
|
||||||
|
image: Visual Studio 2019
|
||||||
|
configuration: Release
|
||||||
|
environment:
|
||||||
|
RETAILCRM_URL:
|
||||||
|
secure: +XvDVl4qowEEYYTdURDytjGjtBPeyehSzCqQs4XcavM=
|
||||||
|
RETAILCRM_KEY:
|
||||||
|
secure: xRC/iy3F1W4PCS1V1eiruJv4Sdj4A9Ln2s36fp0MtgiiIdGDHeK+Qmlm+eHAZgjh
|
||||||
|
RETAILCRM_SITE:
|
||||||
|
secure: 2w6OVirZRJLlkzME0kpXzQ==
|
||||||
|
RETAILCRM_STORE:
|
||||||
|
secure: UCnYSIgosQyIqtVwDrVv4w==
|
||||||
|
RETAILCRM_USER:
|
||||||
|
secure: tClF7XYbv+nGE5WpZIF7ng==
|
||||||
|
before_build:
|
||||||
|
- ps: nuget restore
|
||||||
|
build:
|
||||||
|
verbosity: minimal
|
Loading…
Add table
Reference in a new issue