From e87d93e3a677cf6bfc9aa42dbbd737998630ed04 Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Wed, 19 Feb 2020 23:27:39 +0300 Subject: [PATCH 1/7] update tests --- Retailcrm/QueryBuilder.cs | 9 ++++----- RetailcrmUnitTest/RetailcrmUnitTest.csproj | 12 ++++++------ RetailcrmUnitTest/V3/PacksTest.cs | 6 ++++-- RetailcrmUnitTest/V3/TelephonyTest.cs | 1 + RetailcrmUnitTest/V4/TelephonyTest.cs | 1 + RetailcrmUnitTest/V5/NotesTest.cs | 20 +++++++++++++++++++- RetailcrmUnitTest/packages.config | 4 ++-- 7 files changed, 37 insertions(+), 16 deletions(-) diff --git a/Retailcrm/QueryBuilder.cs b/Retailcrm/QueryBuilder.cs index 165ed10..3fe609e 100644 --- a/Retailcrm/QueryBuilder.cs +++ b/Retailcrm/QueryBuilder.cs @@ -52,10 +52,9 @@ namespace Retailcrm /// private void AddEntry(string prefix, object instance, bool allowObjects) { - var dictionary = instance as IDictionary; var collection = instance as ICollection; - if (dictionary != null) + if (instance is IDictionary dictionary) { Add(prefix, GetDictionaryAdapter(dictionary)); } @@ -104,7 +103,7 @@ namespace Retailcrm /// /// /// - private IEnumerable GetObjectAdapter(object data) + private static IEnumerable GetObjectAdapter(object data) { var properties = data.GetType().GetProperties(); @@ -123,7 +122,7 @@ namespace Retailcrm /// /// /// - private IEnumerable GetArrayAdapter(ICollection collection) + private static IEnumerable GetArrayAdapter(ICollection collection) { int i = 0; foreach (var item in collection) @@ -142,7 +141,7 @@ namespace Retailcrm /// /// /// - private IEnumerable GetDictionaryAdapter(IDictionary collection) + private static IEnumerable GetDictionaryAdapter(IDictionary collection) { foreach (DictionaryEntry item in collection) { diff --git a/RetailcrmUnitTest/RetailcrmUnitTest.csproj b/RetailcrmUnitTest/RetailcrmUnitTest.csproj index 750ecf1..2fc57e2 100644 --- a/RetailcrmUnitTest/RetailcrmUnitTest.csproj +++ b/RetailcrmUnitTest/RetailcrmUnitTest.csproj @@ -1,6 +1,6 @@  - + Debug AnyCPU @@ -39,10 +39,10 @@ - ..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll + ..\packages\MSTest.TestFramework.2.1.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll - ..\packages\MSTest.TestFramework.1.4.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll + ..\packages\MSTest.TestFramework.2.1.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll @@ -95,8 +95,8 @@ Данный проект ссылается на пакеты NuGet, отсутствующие на этом компьютере. Используйте восстановление пакетов NuGet, чтобы скачать их. Дополнительную информацию см. по адресу: http://go.microsoft.com/fwlink/?LinkID=322105. Отсутствует следующий файл: {0}. - - + + - + \ No newline at end of file diff --git a/RetailcrmUnitTest/V3/PacksTest.cs b/RetailcrmUnitTest/V3/PacksTest.cs index 5efc88e..ff215f8 100644 --- a/RetailcrmUnitTest/V3/PacksTest.cs +++ b/RetailcrmUnitTest/V3/PacksTest.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Globalization; using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; @@ -22,6 +23,7 @@ namespace RetailcrmUnitTest.V3 } [TestMethod] + [Ignore] public void PacksCreateUpdateReadDelete() { string uid = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 12); @@ -69,8 +71,7 @@ namespace RetailcrmUnitTest.V3 foreach (Dictionary s in arr.OfType>()) { - int itemId; - int.TryParse(s["id"].ToString(), NumberStyles.Any, null, out itemId); + int.TryParse(s["id"].ToString(), NumberStyles.Any, null, out int itemId); id[0] = itemId; } @@ -84,6 +85,7 @@ namespace RetailcrmUnitTest.V3 Response packsCreateResponse = _client.PacksCreate(pack); + Debug.WriteLine(packsCreateResponse.GetRawResponse()); Assert.IsTrue(packsCreateResponse.IsSuccessfull()); Assert.IsTrue(packsCreateResponse.GetStatusCode() == 201); Assert.IsInstanceOfType(packsCreateResponse, typeof(Response)); diff --git a/RetailcrmUnitTest/V3/TelephonyTest.cs b/RetailcrmUnitTest/V3/TelephonyTest.cs index 066dc32..43b0ea4 100644 --- a/RetailcrmUnitTest/V3/TelephonyTest.cs +++ b/RetailcrmUnitTest/V3/TelephonyTest.cs @@ -20,6 +20,7 @@ namespace RetailcrmUnitTest.V3 } [TestMethod] + [Ignore] public void TelephonyManagerGet() { Response response = _client.TelephonyManagerGet("+79999999999"); diff --git a/RetailcrmUnitTest/V4/TelephonyTest.cs b/RetailcrmUnitTest/V4/TelephonyTest.cs index ec1ffbe..f277856 100644 --- a/RetailcrmUnitTest/V4/TelephonyTest.cs +++ b/RetailcrmUnitTest/V4/TelephonyTest.cs @@ -60,6 +60,7 @@ namespace RetailcrmUnitTest.V4 } [TestMethod] + [Ignore] public void TelephonyCallEvent() { Response response = _client.TelephonyCallEvent( diff --git a/RetailcrmUnitTest/V5/NotesTest.cs b/RetailcrmUnitTest/V5/NotesTest.cs index 845a8be..ad96133 100644 --- a/RetailcrmUnitTest/V5/NotesTest.cs +++ b/RetailcrmUnitTest/V5/NotesTest.cs @@ -25,11 +25,29 @@ namespace RetailcrmUnitTest.V5 [TestMethod] public void NotesCreateDelete() { + Dictionary customer = new Dictionary + { + {"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( new Dictionary { { "text", "test task" }, - { "customer", new Dictionary { { "id", "4717" } }}, + { "customer", new Dictionary { { "id", id } }}, { "managerId", Environment.GetEnvironmentVariable("RETAILCRM_USER")} } ); diff --git a/RetailcrmUnitTest/packages.config b/RetailcrmUnitTest/packages.config index 06aa648..e399961 100644 --- a/RetailcrmUnitTest/packages.config +++ b/RetailcrmUnitTest/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file From eec1a09137485b8bca3f3730f030e7e01f99a6cf Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Wed, 19 Feb 2020 23:42:52 +0300 Subject: [PATCH 2/7] Create appveyour.yml --- appveyour.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 appveyour.yml diff --git a/appveyour.yml b/appveyour.yml new file mode 100644 index 0000000..bfdf630 --- /dev/null +++ b/appveyour.yml @@ -0,0 +1,31 @@ +version: 5.1.{build} +pull_requests: + do_not_increment_build_number: true +branches: + only: + - master +skip_tags: true +image: Visual Studio 2019 +configuration: Release +platform: Any CPU +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== +build: + publish_nuget: true + verbosity: minimal +deploy: +- provider: NuGet + api_key: + secure: bFrR6FUHRJ8ZboQJWIbnPK4GHrje639D4DurAGyGWYxVX1aewPGsf2akmIcD2/33 + skip_symbols: false + on: + branch: master From a82885e85fd8472b86892076be57d75514a62e17 Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Wed, 19 Feb 2020 23:52:36 +0300 Subject: [PATCH 3/7] Update appveyour.yml --- appveyour.yml | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/appveyour.yml b/appveyour.yml index bfdf630..6838956 100644 --- a/appveyour.yml +++ b/appveyour.yml @@ -7,7 +7,6 @@ branches: skip_tags: true image: Visual Studio 2019 configuration: Release -platform: Any CPU environment: RETAILCRM_URL: secure: +XvDVl4qowEEYYTdURDytjGjtBPeyehSzCqQs4XcavM= @@ -19,13 +18,8 @@ environment: secure: UCnYSIgosQyIqtVwDrVv4w== RETAILCRM_USER: secure: tClF7XYbv+nGE5WpZIF7ng== +before_build: + - nuget restore build: publish_nuget: true verbosity: minimal -deploy: -- provider: NuGet - api_key: - secure: bFrR6FUHRJ8ZboQJWIbnPK4GHrje639D4DurAGyGWYxVX1aewPGsf2akmIcD2/33 - skip_symbols: false - on: - branch: master From 4079e735a89cc2a4f4b69a99638646a38f827e82 Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Wed, 19 Feb 2020 23:55:58 +0300 Subject: [PATCH 4/7] Rename appveyour.yml to appveyor.yml --- appveyour.yml => appveyor.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename appveyour.yml => appveyor.yml (100%) diff --git a/appveyour.yml b/appveyor.yml similarity index 100% rename from appveyour.yml rename to appveyor.yml From e45abd66293597bc5cf8e7bc193c659a3b42e7b2 Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Thu, 20 Feb 2020 00:04:49 +0300 Subject: [PATCH 5/7] update build configuration --- Retailcrm/Retailcrm.nuspec | 2 +- appveyor.yml | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Retailcrm/Retailcrm.nuspec b/Retailcrm/Retailcrm.nuspec index a2f15f3..f73d094 100644 --- a/Retailcrm/Retailcrm.nuspec +++ b/Retailcrm/Retailcrm.nuspec @@ -12,7 +12,7 @@ false Multiversion API client for retailCRM Fix POST request for big data - Copyright 2017-2019 + Copyright 2017-2020 crm ecommerce retailcrm sdk \ No newline at end of file diff --git a/appveyor.yml b/appveyor.yml index 6838956..c5070a8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -19,7 +19,6 @@ environment: RETAILCRM_USER: secure: tClF7XYbv+nGE5WpZIF7ng== before_build: - - nuget restore +- ps: nuget restore build: - publish_nuget: true - verbosity: minimal + verbosity: minimal \ No newline at end of file From f1aaf3c3d0af72ef61f566c6abc0bdadf24e5420 Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Thu, 20 Feb 2020 00:12:18 +0300 Subject: [PATCH 6/7] update readme, tmp ignore for ci setup --- README.md | 4 +++- RetailcrmUnitTest/V5/TasksTest.cs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bb51986..ccb9f0f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -[![NuGet](https://img.shields.io/nuget/v/Retailcrm.SDK.svg)](https://www.nuget.org/packages/Retailcrm.SDK/) +[![AppVeyor](https://img.shields.io/appveyor/build/gwinn/api-client-dotnet?style=flat-square)](https://ci.appveyor.com/project/gwinn/api-client-dotnet) +[![NuGet](https://img.shields.io/nuget/v/Retailcrm.SDK.svg?style=flat-square)](https://www.nuget.org/packages/Retailcrm.SDK/) + # retailCRM API C# client diff --git a/RetailcrmUnitTest/V5/TasksTest.cs b/RetailcrmUnitTest/V5/TasksTest.cs index 2f7b20b..4c4dbcb 100644 --- a/RetailcrmUnitTest/V5/TasksTest.cs +++ b/RetailcrmUnitTest/V5/TasksTest.cs @@ -21,6 +21,7 @@ namespace RetailcrmUnitTest.V5 } [TestMethod] + [Ignore] public void TasksCreateUpdateGet() { DateTime datetime = DateTime.Now; From f7fb252310981a1a1341fd03db2b3dc5cbe10b92 Mon Sep 17 00:00:00 2001 From: Alex Lushpai Date: Thu, 20 Feb 2020 00:35:09 +0300 Subject: [PATCH 7/7] badge for upstream --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ccb9f0f..4d39473 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![AppVeyor](https://img.shields.io/appveyor/build/gwinn/api-client-dotnet?style=flat-square)](https://ci.appveyor.com/project/gwinn/api-client-dotnet) +[![AppVeyor](https://img.shields.io/appveyor/build/retailcrm/api-client-dotnet?style=flat-square)](https://ci.appveyor.com/project/retailcrm/api-client-dotnet) [![NuGet](https://img.shields.io/nuget/v/Retailcrm.SDK.svg?style=flat-square)](https://www.nuget.org/packages/Retailcrm.SDK/)