Modify test for autobuild (#9)

* update test to use env variables
This commit is contained in:
Alex Lushpai 2018-03-21 15:56:36 +03:00 committed by GitHub
parent b5261b02b0
commit 8ef01ecfb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 162 additions and 149 deletions

1
.gitignore vendored
View File

@ -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

View File

@ -1,6 +1,6 @@
The MIT License (MIT) 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 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

View File

@ -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 ``` bash
PM> Install-Package Retailcrm.SDK PM> Install-Package Retailcrm.SDK
``` ```
Примеры использования ## Usage
---------------------
### Получение информации о заказе ### Get order
``` csharp ``` csharp
using System.Diagnostics; using System.Diagnostics;
@ -31,7 +31,7 @@ if (response.isSuccessful()) {
} }
``` ```
### Создание заказа ### Create order
``` csharp ``` csharp
using System.Diagnostics; 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)

View 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>

View File

@ -12,8 +12,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]

View File

@ -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>

View File

@ -81,8 +81,6 @@
<Compile Include="V5\SegmentsTest.cs" /> <Compile Include="V5\SegmentsTest.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="App.config" />
<None Include="App.config.dist" />
<None Include="packages.config"> <None Include="packages.config">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>

View File

@ -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]

View File

@ -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();

View File

@ -15,8 +15,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]

View File

@ -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.Globalization; using System.Globalization;
using System.Linq; using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.UnitTesting;
@ -14,12 +12,13 @@ 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]
@ -79,7 +78,7 @@ 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]}
}; };
@ -125,7 +124,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);

View File

@ -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]

View File

@ -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}
} }

View File

@ -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,19 @@ 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]
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);

View File

@ -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]

View File

@ -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]

View File

@ -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]

View File

@ -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]

View File

@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic;
using System.Collections.Specialized; 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;
@ -17,8 +14,10 @@ namespace RetailcrmUnitTest.V4
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]

View File

@ -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 }
} }
} }
@ -66,11 +65,11 @@ namespace RetailcrmUnitTest.V4
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")) }}
} }
); );

View File

@ -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));

View File

@ -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]

View File

@ -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]

View File

@ -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"},

View File

@ -13,12 +13,13 @@ 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]
@ -28,8 +29,8 @@ namespace RetailcrmUnitTest.V5
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", "4717" } }},
{ "managerId", _appSettings["manager"]} { "managerId", Environment.GetEnvironmentVariable("RETAILCRM_USER")}
} }
); );

View File

@ -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]

View File

@ -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]

View File

@ -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]

View File

@ -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]

View File

@ -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,12 +11,13 @@ 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]
@ -32,7 +31,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 +48,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 +73,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,

View File

@ -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]

View File

@ -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]