From 7dd0a385121734baee1d1ead12fa86b8a88848b4 Mon Sep 17 00:00:00 2001 From: vmalinovskiy Date: Tue, 4 Jun 2019 23:59:58 +0300 Subject: [PATCH 1/2] vmalinovskiy - nunit upgrade with restsharp version limitation --- CallfireApiClient.nuspec | 213 +++++---- Changelog.txt | 4 + build.gradle | 3 + .../Api/AbstractIntegrationTest.cs | 10 +- .../Api/CallsTexts/CallsApiIntegrationTest.cs | 4 +- .../Api/CallsTexts/MediaApiIntegrationTest.cs | 15 +- .../CampaignSoundsApiIntegrationTest.cs | 12 +- .../TextBroadcastsApiIntegrationTest.cs | 2 +- .../ContactListsApiIntegrationTest.cs | 2 +- .../Numbers/NumberLeasesApiIntegrationTest.cs | 4 +- .../Api/Numbers/NumbersApiIntegrationTest.cs | 2 +- .../Api/ProxyIntegrationTest.cs | 2 +- .../CallfireApiClient.IntegrationTests.csproj | 12 +- .../packages.config | 3 +- .../Api/AbstractApiTest.cs | 10 +- .../Api/Account/MeApiTest.cs | 6 +- .../Api/CallsTexts/CallsApiTest.cs | 34 +- .../Api/CallsTexts/MediaApiTest.cs | 4 +- .../Api/Campaigns/BatchesApiTest.cs | 6 +- .../Api/Campaigns/CallBroadcastsApiTest.cs | 26 +- .../Api/Campaigns/CampaignSoundsApiTest.cs | 16 +- .../Api/Campaigns/TextAutoRepliesApiTest.cs | 2 +- .../Api/Campaigns/TextBroadcastsApiTest.cs | 24 +- .../Api/Contacts/ContactListsApiTest.cs | 28 +- .../Api/Contacts/ContactsApiTest.cs | 4 +- .../Api/Contacts/DncApiTest.cs | 26 +- .../Api/Keywords/KeywordLeasesApiTest.cs | 6 +- .../Api/Numbers/NumberLeasesApiTest.cs | 4 +- .../Api/Webhooks/WebhooksApiTest.cs | 6 +- .../CallfireApiClient.Tests.csproj | 448 +++++++++--------- src/CallfireApiClient.Tests/MockRestClient.cs | 1 - src/CallfireApiClient.Tests/packages.config | 4 +- .../CallfireApiClient.csproj | 8 +- .../Properties/AssemblyInfo.cs | 2 +- src/CallfireApiClient/RequestFilter.cs | 1 - src/CallfireApiClient/packages.config | 7 +- 36 files changed, 495 insertions(+), 466 deletions(-) diff --git a/CallfireApiClient.nuspec b/CallfireApiClient.nuspec index 2474b1f..3b03937 100644 --- a/CallfireApiClient.nuspec +++ b/CallfireApiClient.nuspec @@ -1,7 +1,7 @@ CallfireApiClient - 1.1.28 + 1.1.29 CallFire API v2 client Vladimir Mikhailov @@ -13,111 +13,114 @@ https://www.callfire.com/favicon.ico false C# client library for integration with Callfire REST API v2 services - - Callfire API client Changelog - ============================= - Version 1.1.28 - March 06 2019 - - added date interval filtering parameters to broadcasts lookup - - Version 1.1.27 - Feb 28 2019 - - fixed isssue with Broadcast Status enum - - Version 1.1.26 - Jan 17 2019 - - updated RestSharp version to 106.6 - - Version 1.1.24 - Oct 17 2018 - - removed potential security vulnerability connected with DotNetZip library - - Version 1.1.23 - Sept 26 2018 - - added findMedia API operation to sdk - - Version 1.1.22 - Sept 04 2018 - - updated version of RestSharp client to 106.3.0 - - downgraded version of .NET framework to 4.6 - - Version 1.1.21 - August 10 2018 - - added StrongNamer library to sign unsigned assembly in a nuget package - - Version 1.1.20 - August 1 2018 - - updated .NET framework target version to latest for support TLS 1.2 by default - - Version 1.1.19 - Jun 13 2017 - - added fromNumber to Recipient object for sending calls/texts - - added strictValidation flag for adding contacts to broadcast - - added useCustomFields to createContactList/addContactListContacts apis - - added media array parameter for TextRecipient - - added a way to upload files from byte array for media and campaign sounds api - - Version 1.1.18 - May 29 2017 - - upgraded dependencies - - Version 1.1.17 - May 4 2017 - - removed subscriptions api (not supported from v2 api client) - - fixed findWebhooks api to use enums instead strings - - trivial tests fixes - - Version 1.1.16 - Mar 28 2017 - - fixed DayOfWeek enum for scheduler - - Version 1.1.15 - Jan 27 2017 - - added dnc apis - - Version 1.1.14 - Jan 17 2017 - - added possibility to use client without config file - - Version 1.1.13 - Dec 30 2016 - - minor fixes for get contacts history api - - Version 1.1.12 - Dec 28 2016 - - updated CallRecord dto to include originateTime, answerTime, duration, callerName and switchId fields - - updated Webhook dto to include singleUse parameter - - minor extension of requests objects for upload and find sounds api, get contacts history api and find tollfree numbers api - - temporary turning dnc api off due to full remake of callfire dnc apis - - Version 1.1.11 - Nov 18 2016 - - added deleteCampaignSound api - - added getCreditsHistory api - - remove dnc lists api (not supported anymore) - - Version 1.1.10 - Oct 26 2016 - - added more parameters to call tracking config in Number Lease config object - - Version 1.1.9 - Jul 11 2016 - - added loading labels parameter in Number Lease objects - - Version 1.1.8 - May 27 2016 - - defaultLiveMessage, defaultMachineMessage, defaultLiveMessageSoundId, defaultMachineMessageSoundId, defaultVoice params added to send calls api - - added batch id filter parameter for get broadcast calls/texts - - added fields filter parameter for add sound via call, returns CampaignSound object - - added fields filter parameter for add sound via text-to-speech, returns CampaignSound object - - defaultMessage parameter added to send texts function - - added findWebhookResource and findWebhookResources methods to use new webhooks apis - - resumeNextDay parameter added to CallBroadcast object - - transferMessage, transferMessageSoundId, transferDigit, transferNumber params added to CallRecipient object for sending calls and texts - - added questionResponses parameter to CallRecord object - - added duplicate parameter to CampaignSound object - - get call recordings api functions implemented in CallsApi - - Version 1.1.7 - Apr 18 2016 - - migration to 4.5 net framework - - migration to gradle - - Version 1.1.6 - Mar 25 2016 - - added mono debug files generation on Windows platform - - removed get/update batch api calls from TextBroadcastsApi - - Version 1.1.5 - Mar 14 2016 - - added debug support for Mono platform - - fixed issue with uploading mp3 media - - Version 1.1.4 - Mar 4 2016 - - added proxy with basic authorization support, see out docs how to configure it. - - Version 1.1.3 - Feb 16 2016 - - added nuget symbolsource package to debug source code. + Callfire API client Changelog +============================= +Version 1.1.29 - May 29 2019 +- dependecies upgraded (Nunit to v3) +- added allowedVersions for dependencies - Version 1.1.2 - Jan 27 2016 - - added find by batchId parameter to FindCalls & FindTexts requests. +Version 1.1.28 - March 06 2019 +- added date interval filtering parameters to broadcasts lookup + +Version 1.1.27 - Feb 28 2019 + - fixed isssue with Broadcast Status enum + +Version 1.1.26 - Jan 17 2019 + - updated RestSharp version to 106.6 + +Version 1.1.24 - Oct 17 2018 + - removed potential security vulnerability connected with DotNetZip library + +Version 1.1.23 - Sept 26 2018 + - added findMedia API operation to sdk + +Version 1.1.22 - Sept 04 2018 + - updated version of RestSharp client to 106.3.0 + - downgraded version of .NET framework to 4.6 + +Version 1.1.21 - August 10 2018 + - added StrongNamer library to sign unsigned assembly in a nuget package + +Version 1.1.20 - August 1 2018 + - updated .NET framework target version to latest for support TLS 1.2 by default + +Version 1.1.19 - Jun 13 2017 +- added fromNumber to Recipient object for sending calls/texts +- added strictValidation flag for adding contacts to broadcast +- added useCustomFields to createContactList/addContactListContacts apis +- added media array parameter for TextRecipient +- added a way to upload files from byte array for media and campaign sounds api + +Version 1.1.18 - May 29 2017 +- upgraded dependencies + +Version 1.1.17 - May 4 2017 +- removed subscriptions api (not supported from v2 api client) +- fixed findWebhooks api to use enums instead strings +- trivial tests fixes + +Version 1.1.16 - Mar 28 2017 +- fixed DayOfWeek enum for scheduler + +Version 1.1.15 - Jan 27 2017 +- added dnc apis + +Version 1.1.14 - Jan 17 2017 +- added possibility to use client without config file + +Version 1.1.13 - Dec 30 2016 +- minor fixes for get contacts history api + +Version 1.1.12 - Dec 28 2016 +- updated CallRecord dto to include originateTime, answerTime, duration, callerName and switchId fields +- updated Webhook dto to include singleUse parameter +- minor extension of requests objects for upload and find sounds api, get contacts history api and find tollfree numbers api +- temporary turning dnc api off due to full remake of callfire dnc apis + +Version 1.1.11 - Nov 18 2016 +- added deleteCampaignSound api +- added getCreditsHistory api +- remove dnc lists api (not supported anymore) + +Version 1.1.10 - Oct 26 2016 +- added more parameters to call tracking config in Number Lease config object + +Version 1.1.9 - Jul 11 2016 +- added loading labels parameter in Number Lease objects + +Version 1.1.8 - May 27 2016 +- defaultLiveMessage, defaultMachineMessage, defaultLiveMessageSoundId, defaultMachineMessageSoundId, defaultVoice params added to send calls api +- added batch id filter parameter for get broadcast calls/texts +- added fields filter parameter for add sound via call, returns CampaignSound object +- added fields filter parameter for add sound via text-to-speech, returns CampaignSound object +- defaultMessage parameter added to send texts function +- added findWebhookResource and findWebhookResources methods to use new webhooks apis +- resumeNextDay parameter added to CallBroadcast object +- transferMessage, transferMessageSoundId, transferDigit, transferNumber params added to CallRecipient object for sending calls and texts +- added questionResponses parameter to CallRecord object +- added duplicate parameter to CampaignSound object +- get call recordings api functions implemented in CallsApi + +Version 1.1.7 - Apr 18 2016 +- migration to 4.5 net framework +- migration to gradle + +Version 1.1.6 - Mar 25 2016 +- added mono debug files generation on Windows platform +- removed get/update batch api calls from TextBroadcastsApi + +Version 1.1.5 - Mar 14 2016 +- added debug support for Mono platform +- fixed issue with uploading mp3 media + +Version 1.1.4 - Mar 4 2016 +- added proxy with basic authorization support, see out docs how to configure it. + +Version 1.1.3 - Feb 16 2016 +- added nuget symbolsource package to debug source code. + +Version 1.1.2 - Jan 27 2016 +- added find by batchId parameter to FindCalls & FindTexts requests. - fixed NumberApi.findNumbersLocal and NumberApi.findNumbersTollfree methods to accept an updated server responses Version 1.1.1 - Jan 25 2016 diff --git a/Changelog.txt b/Changelog.txt index db2579f..503ed3f 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,9 @@ Callfire API client Changelog ============================= +Version 1.1.29 - May 29 2019 +- dependecies upgraded (Nunit to v3) +- added allowedVersions for dependencies + Version 1.1.28 - March 06 2019 - added date interval filtering parameters to broadcasts lookup diff --git a/build.gradle b/build.gradle index d2e3514..110885f 100644 --- a/build.gradle +++ b/build.gradle @@ -15,6 +15,7 @@ plugins { } archivesBaseName = 'callfire-api-client' +ext['nunitConsoleVersion'] = '3.6.1' ext['buildReleaseConfiguration'] = "CallfireApiClient" ext['buildReleaseConfiguration'] = "Release" ext['buildDebugConfiguration'] = "Debug" @@ -45,6 +46,7 @@ task msbuildDebug (type: com.ullink.Msbuild) { msbuildDebug.dependsOn nunit nunit { + nunitVersion = nunitConsoleVersion testAssemblies = [ msbuild.projects['CallfireApiClient.Tests'].properties.TargetPath ] } nunit.dependsOn msbuild @@ -162,6 +164,7 @@ task msbuildForIntegrationTests (type: com.ullink.Msbuild) { msbuildForIntegrationTests.dependsOn prepareTestData task integrationTests (type: com.ullink.gradle.nunit.NUnit) { + nunitVersion = nunitConsoleVersion testAssemblies = [ msbuild.projects['CallfireApiClient.IntegrationTests'].properties.TargetPath ] } integrationTests.dependsOn msbuildForIntegrationTests diff --git a/src/CallfireApiClient.IntegrationTests/Api/AbstractIntegrationTest.cs b/src/CallfireApiClient.IntegrationTests/Api/AbstractIntegrationTest.cs index b2c1511..b393f3f 100644 --- a/src/CallfireApiClient.IntegrationTests/Api/AbstractIntegrationTest.cs +++ b/src/CallfireApiClient.IntegrationTests/Api/AbstractIntegrationTest.cs @@ -1,6 +1,7 @@ -using System; +using NUnit.Framework; +using System; using System.Configuration; - +using System.IO; namespace CallfireApiClient.IntegrationTests.Api { @@ -38,6 +39,11 @@ private void ReadAllSettings() Console.WriteLine("Error reading app settings"); } } + + public static string GetFullPath(string path) + { + return Directory.GetParent(TestContext.CurrentContext.TestDirectory).Parent.FullName + path; + } } } diff --git a/src/CallfireApiClient.IntegrationTests/Api/CallsTexts/CallsApiIntegrationTest.cs b/src/CallfireApiClient.IntegrationTests/Api/CallsTexts/CallsApiIntegrationTest.cs index 478fb68..dbb9920 100644 --- a/src/CallfireApiClient.IntegrationTests/Api/CallsTexts/CallsApiIntegrationTest.cs +++ b/src/CallfireApiClient.IntegrationTests/Api/CallsTexts/CallsApiIntegrationTest.cs @@ -101,7 +101,7 @@ public void GetCallRecording() [Test] public void GetCallRecordingInMp3Format() { - string mp3FilePath = "Resources/File-examples/testDownloadRecordingById.mp3"; + string mp3FilePath = GetFullPath("/Resources/File-examples/testDownloadRecordingById.mp3"); MemoryStream ms = (MemoryStream)Client.CallsApi.GetCallRecordingMp3(64837518003); File.WriteAllBytes(mp3FilePath, ms.ToArray()); } @@ -139,7 +139,7 @@ public void GetCallRecordingByName() public void CallRecordingMp3ByName() { CallRecording rec = Client.CallsApi.GetCallRecording(18666772003); - string mp3FilePath = "Resources/File-examples/testDownloadRecordingByName.mp3"; + string mp3FilePath = GetFullPath("/Resources/File-examples/testDownloadRecordingByName.mp3"); MemoryStream ms = (MemoryStream)Client.CallsApi.GetCallRecordingMp3ByName((long) rec.CallId, rec.Name); File.WriteAllBytes(mp3FilePath, ms.ToArray()); } diff --git a/src/CallfireApiClient.IntegrationTests/Api/CallsTexts/MediaApiIntegrationTest.cs b/src/CallfireApiClient.IntegrationTests/Api/CallsTexts/MediaApiIntegrationTest.cs index 0d2ffc9..b0fa921 100644 --- a/src/CallfireApiClient.IntegrationTests/Api/CallsTexts/MediaApiIntegrationTest.cs +++ b/src/CallfireApiClient.IntegrationTests/Api/CallsTexts/MediaApiIntegrationTest.cs @@ -10,10 +10,10 @@ namespace CallfireApiClient.IntegrationTests.Api.CallsTexts [TestFixture] public class MediaApiIntegrationTest : AbstractIntegrationTest { - private const string mp3FilePath = "Resources/File-examples/train1.mp3"; - private const string wavFilePath = "Resources/File-examples/train1.wav"; - private const string cfLogoFilePath = "Resources/File-examples/cf.png"; - private const string ezLogoFilePath = "Resources/File-examples/ez.png"; + private string mp3FilePath = GetFullPath("/Resources/File-examples/train1.mp3"); + private string wavFilePath = GetFullPath("/Resources/File-examples/train1.wav"); + private string cfLogoFilePath = GetFullPath("/Resources/File-examples/cf.png"); + private string ezLogoFilePath = GetFullPath("/Resources/File-examples/ez.png"); [Test] public void TestFind() @@ -49,9 +49,10 @@ public void TestUpload() [Test] public void TestUploadWithFileData() { - String soundName = "mp3_test_" + DateTime.Now.Millisecond.ToString(); - ResourceId wavResourceId = Client.MediaApi.Upload(File.ReadAllBytes(wavFilePath), MediaType.WAV); - ResourceId mp3ResourceId = Client.MediaApi.Upload(File.ReadAllBytes(mp3FilePath), MediaType.MP3, soundName); + string mp3Name = "mp3_test_" + DateTime.Now.Millisecond.ToString(); + string wavName = "wav_test_" + DateTime.Now.Millisecond.ToString(); + ResourceId wavResourceId = Client.MediaApi.Upload(File.ReadAllBytes(wavFilePath), MediaType.WAV, wavName); + ResourceId mp3ResourceId = Client.MediaApi.Upload(File.ReadAllBytes(mp3FilePath), MediaType.MP3, mp3Name); Assert.NotNull(mp3ResourceId.Id); } diff --git a/src/CallfireApiClient.IntegrationTests/Api/Campaigns/CampaignSoundsApiIntegrationTest.cs b/src/CallfireApiClient.IntegrationTests/Api/Campaigns/CampaignSoundsApiIntegrationTest.cs index fdec17c..f7532d0 100644 --- a/src/CallfireApiClient.IntegrationTests/Api/Campaigns/CampaignSoundsApiIntegrationTest.cs +++ b/src/CallfireApiClient.IntegrationTests/Api/Campaigns/CampaignSoundsApiIntegrationTest.cs @@ -36,7 +36,7 @@ public void TestFind() public void TestUploadSoundAndDeleteIt() { String soundName = "mp3_test_" + DateTime.Now.ToString(); - string mp3FilePath = "Resources/File-examples/train1.mp3"; + string mp3FilePath = GetFullPath("/Resources/File-examples/train1.mp3"); CampaignSound campaignSound = Client.CampaignSoundsApi.UploadAndGetSoundDetails(mp3FilePath, soundName); Assert.NotNull(campaignSound.Id); @@ -52,7 +52,7 @@ public void TestUploadSoundAndDeleteIt() public void TestUploadSoundWithFileDataAndDeleteIt() { String soundName = "mp3_test_" + DateTime.Now.ToString(); - string mp3FilePath = "Resources/File-examples/train1.mp3"; + string mp3FilePath = GetFullPath("/Resources/File-examples/train1.mp3"); CampaignSound campaignSound = Client.CampaignSoundsApi.UploadAndGetSoundDetails(File.ReadAllBytes(mp3FilePath), soundName); Assert.NotNull(campaignSound.Id); @@ -88,8 +88,8 @@ public void TestUploadMp3WavFilesAndGetThem() { String soundName = "mp3_test_" + DateTime.Now.ToString(); - string mp3FilePath = "Resources/File-examples/train1.mp3"; - string wavFilePath = "Resources/File-examples/train1.wav"; + string mp3FilePath = GetFullPath("/Resources/File-examples/train1.mp3"); + string wavFilePath = GetFullPath("/Resources/File-examples/train1.wav"); ResourceId mp3ResourceId = Client.CampaignSoundsApi.Upload(mp3FilePath, soundName); ResourceId wavResourceId = Client.CampaignSoundsApi.Upload(wavFilePath); @@ -105,13 +105,13 @@ public void TestUploadMp3WavFilesAndGetThem() // get mp3 MemoryStream ms = (MemoryStream)Client.CampaignSoundsApi.GetMp3(mp3ResourceId.Id); - string existingFilePath = Path.GetFullPath("Resources/File-examples/train1.mp3"); + string existingFilePath = GetFullPath("/Resources/File-examples/train1.mp3"); string pathToSaveNewFile = existingFilePath.Replace("train.mp3", "mp3_sound.mp3"); File.WriteAllBytes(pathToSaveNewFile, ms.ToArray()); // get wav ms = (MemoryStream)Client.CampaignSoundsApi.GetWav(wavResourceId.Id); - existingFilePath = Path.GetFullPath("Resources/File-examples/train1.wav"); + existingFilePath = GetFullPath("/Resources/File-examples/train1.wav"); pathToSaveNewFile = existingFilePath.Replace("train.wav", "wav_sound.wav"); File.WriteAllBytes(pathToSaveNewFile, ms.ToArray()); diff --git a/src/CallfireApiClient.IntegrationTests/Api/Campaigns/TextBroadcastsApiIntegrationTest.cs b/src/CallfireApiClient.IntegrationTests/Api/Campaigns/TextBroadcastsApiIntegrationTest.cs index 5648851..df0ae25 100644 --- a/src/CallfireApiClient.IntegrationTests/Api/Campaigns/TextBroadcastsApiIntegrationTest.cs +++ b/src/CallfireApiClient.IntegrationTests/Api/Campaigns/TextBroadcastsApiIntegrationTest.cs @@ -151,7 +151,7 @@ public void AddRecipientsAndAddRemoveBatches() var texts = Client.TextBroadcastsApi.AddRecipients((long)id, recipients, null, true); Console.WriteLine(texts); Assert.AreEqual(2, texts.Count); - Assert.That(texts[0].Message, Is.StringStarting("test_msg")); + Assert.That(texts[0].Message, Does.StartWith("test_msg")); // get batches var getBatchesRequest = new GetByIdRequest { Id = id }; diff --git a/src/CallfireApiClient.IntegrationTests/Api/Contacts/ContactListsApiIntegrationTest.cs b/src/CallfireApiClient.IntegrationTests/Api/Contacts/ContactListsApiIntegrationTest.cs index e95881c..f47292b 100644 --- a/src/CallfireApiClient.IntegrationTests/Api/Contacts/ContactListsApiIntegrationTest.cs +++ b/src/CallfireApiClient.IntegrationTests/Api/Contacts/ContactListsApiIntegrationTest.cs @@ -24,7 +24,7 @@ public void TestFindContactLists() [Test] public void TestCreateContactListFromFile() { - string path = "Resources/File-examples/contacts1.csv"; + string path = GetFullPath("/Resources/File-examples/contacts1.csv"); ResourceId listId = Client.ContactListsApi.CreateFromCsv("fileList", Path.GetFullPath(path), true); ContactList contactList = Client.ContactListsApi.Get(listId.Id); diff --git a/src/CallfireApiClient.IntegrationTests/Api/Numbers/NumberLeasesApiIntegrationTest.cs b/src/CallfireApiClient.IntegrationTests/Api/Numbers/NumberLeasesApiIntegrationTest.cs index 865b9d2..2433779 100644 --- a/src/CallfireApiClient.IntegrationTests/Api/Numbers/NumberLeasesApiIntegrationTest.cs +++ b/src/CallfireApiClient.IntegrationTests/Api/Numbers/NumberLeasesApiIntegrationTest.cs @@ -30,7 +30,7 @@ public void GetNumberLease() Assert.IsNotNull(lease.Region); Assert.AreEqual(number, lease.PhoneNumber); Assert.True(lease.Labels.Count > 0); - Assert.That(lease.Region.City, Is.StringContaining("LOS ANGELES")); + Assert.That(lease.Region.City, Does.Contain("LOS ANGELES")); } [Test] @@ -76,7 +76,7 @@ public void GetNumberLeaseConfig() } [Test] - [Ignore] + [Ignore("to avoid test account numbers configuration changes")] public void UpdateNumberLeaseConfig() { const string number = "12132041238"; diff --git a/src/CallfireApiClient.IntegrationTests/Api/Numbers/NumbersApiIntegrationTest.cs b/src/CallfireApiClient.IntegrationTests/Api/Numbers/NumbersApiIntegrationTest.cs index 48f05b1..4a01f6c 100644 --- a/src/CallfireApiClient.IntegrationTests/Api/Numbers/NumbersApiIntegrationTest.cs +++ b/src/CallfireApiClient.IntegrationTests/Api/Numbers/NumbersApiIntegrationTest.cs @@ -60,7 +60,7 @@ public void FindNumberRegions() }; var regions = Client.NumbersApi.FindNumberRegions(request); Assert.AreEqual(2, regions.Items.Count); - Assert.That(regions.Items[0].City, Is.StringContaining("CHICAGO")); + Assert.That(regions.Items[0].City, Does.Contain("CHICAGO")); Assert.AreEqual("1773271", regions.Items[0].Prefix); Console.WriteLine(regions); diff --git a/src/CallfireApiClient.IntegrationTests/Api/ProxyIntegrationTest.cs b/src/CallfireApiClient.IntegrationTests/Api/ProxyIntegrationTest.cs index 32c1a70..33190b3 100644 --- a/src/CallfireApiClient.IntegrationTests/Api/ProxyIntegrationTest.cs +++ b/src/CallfireApiClient.IntegrationTests/Api/ProxyIntegrationTest.cs @@ -3,7 +3,7 @@ namespace CallfireApiClient.IntegrationTests.Api { - [TestFixture, Ignore] + [TestFixture, Ignore("proxy not configured on CI servers")] public class ProxyIntegrationTest { [Test] diff --git a/src/CallfireApiClient.IntegrationTests/CallfireApiClient.IntegrationTests.csproj b/src/CallfireApiClient.IntegrationTests/CallfireApiClient.IntegrationTests.csproj index ef519a9..0959b5d 100644 --- a/src/CallfireApiClient.IntegrationTests/CallfireApiClient.IntegrationTests.csproj +++ b/src/CallfireApiClient.IntegrationTests/CallfireApiClient.IntegrationTests.csproj @@ -1,5 +1,6 @@  + Debug AnyCPU @@ -33,10 +34,11 @@ false - - - ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll + True + @@ -73,10 +75,10 @@ Designer - Always + @@ -90,7 +92,7 @@ Always - + diff --git a/src/CallfireApiClient.IntegrationTests/packages.config b/src/CallfireApiClient.IntegrationTests/packages.config index b9014c5..422b832 100644 --- a/src/CallfireApiClient.IntegrationTests/packages.config +++ b/src/CallfireApiClient.IntegrationTests/packages.config @@ -1,4 +1,5 @@  - + + \ No newline at end of file diff --git a/src/CallfireApiClient.Tests/Api/AbstractApiTest.cs b/src/CallfireApiClient.Tests/Api/AbstractApiTest.cs index 47f8380..0527d04 100644 --- a/src/CallfireApiClient.Tests/Api/AbstractApiTest.cs +++ b/src/CallfireApiClient.Tests/Api/AbstractApiTest.cs @@ -5,6 +5,7 @@ using System.IO; using System.Text; using RestSharp.Deserializers; +using NUnit.Framework; namespace CallfireApiClient.Tests.Api { @@ -14,7 +15,7 @@ public class AbstractApiTest protected const string TEST_STRING = "test"; protected const string FIELDS = "id,name,created"; protected string ENCODED_FIELDS = "fields=" + Uri.EscapeUriString(FIELDS); - protected const string BASE_PATH = "../../JsonMocks"; + protected const string MOCKS_PATH = "\\JsonMocks"; protected const string EMPTY_ID_MSG = "id cannot be null"; protected const string EMPTY_REQUEST_ID_MSG = "request.id cannot be null"; protected CallfireClient Client; @@ -32,7 +33,7 @@ public AbstractApiTest() protected string GetJsonPayload(string path) { var result = new StringBuilder(); - string[] jsonLines = File.ReadAllLines(BASE_PATH + path); + string[] jsonLines = File.ReadAllLines(GetFullPath(MOCKS_PATH + path)); foreach (var line in jsonLines) { string formatted = line.Trim(); @@ -58,6 +59,11 @@ protected Ref MockRestResponse(string responseData = "", HttpStatu }); return ((MockRestClient)Client.RestApiClient.RestClient).CapturedRequest; } + + public static string GetFullPath(string path) + { + return Directory.GetParent(TestContext.CurrentContext.TestDirectory).Parent.FullName + path; + } } } diff --git a/src/CallfireApiClient.Tests/Api/Account/MeApiTest.cs b/src/CallfireApiClient.Tests/Api/Account/MeApiTest.cs index 0d8a868..40adbda 100644 --- a/src/CallfireApiClient.Tests/Api/Account/MeApiTest.cs +++ b/src/CallfireApiClient.Tests/Api/Account/MeApiTest.cs @@ -75,7 +75,7 @@ public void SendVerificationCode() Client.MeApi.SendVerificationCode(callerId); Assert.AreEqual(Method.POST, request.Value.Method); - Assert.That(request.Value.Resource, Is.StringContaining(callerId)); + Assert.That(request.Value.Resource, Does.Contain(callerId)); } [Test] @@ -96,7 +96,7 @@ public void VerifyCallerId() var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.That(Serializer.Serialize(requestBodyParam.Value), Is.EqualTo(requestJson)); - Assert.That(restRequest.Value.Resource, Is.StringContaining(request.CallerId)); + Assert.That(restRequest.Value.Resource, Does.Contain(request.CallerId)); } [Test] @@ -157,7 +157,7 @@ public void DeleteApiCredentials() Client.MeApi.DeleteApiCredentials(11L); Assert.AreEqual(Method.DELETE, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/11")); + Assert.That(restRequest.Value.Resource, Does.Contain("/11")); } } } diff --git a/src/CallfireApiClient.Tests/Api/CallsTexts/CallsApiTest.cs b/src/CallfireApiClient.Tests/Api/CallsTexts/CallsApiTest.cs index 5af2895..872718a 100644 --- a/src/CallfireApiClient.Tests/Api/CallsTexts/CallsApiTest.cs +++ b/src/CallfireApiClient.Tests/Api/CallsTexts/CallsApiTest.cs @@ -32,8 +32,8 @@ public void SendCalls() Assert.That(Serializer.Serialize(requestBodyParam.Value), Is.EqualTo(requestJson)); calls = Client.CallsApi.Send(new List { r1, r2 }, 10, FIELDS); - Assert.That(restRequest.Value.Resource, !Is.StringContaining("fields" + FIELDS)); - Assert.That(restRequest.Value.Resource, !Is.StringContaining("campaignId=100")); + Assert.That(restRequest.Value.Resource, !Does.Contain("fields" + FIELDS)); + Assert.That(restRequest.Value.Resource, !Does.Contain("campaignId=100")); } [Test] @@ -67,15 +67,15 @@ public void SendCallsUsingRequest() Assert.That(Serializer.Serialize(requestBodyParam.Value), Is.EqualTo(requestJson)); calls = Client.CallsApi.Send(new List { r1, r2 }, 10, FIELDS); - Assert.That(restRequest.Value.Resource, !Is.StringContaining("fields" + FIELDS)); - Assert.That(restRequest.Value.Resource, !Is.StringContaining("campaignId=10")); - Assert.That(restRequest.Value.Resource, !Is.StringContaining("defaultLiveMessage=DefaultLiveMessage")); - Assert.That(restRequest.Value.Resource, !Is.StringContaining("defaultMachineMessage=DefaultMachineMessage")); - Assert.That(restRequest.Value.Resource, !Is.StringContaining("defaultLiveMessageSoundId=1")); - Assert.That(restRequest.Value.Resource, !Is.StringContaining("defaultMachineMessageSoundId=1")); - Assert.That(restRequest.Value.Resource, !Is.StringContaining("defaultMachineMessageSoundId=1")); - Assert.That(restRequest.Value.Resource, !Is.StringContaining("defaultVoice=FRENCHCANADIAN1")); - Assert.That(restRequest.Value.Resource, !Is.StringContaining("strictValidation=TRUE")); + Assert.That(restRequest.Value.Resource, !Does.Contain("fields" + FIELDS)); + Assert.That(restRequest.Value.Resource, !Does.Contain("campaignId=10")); + Assert.That(restRequest.Value.Resource, !Does.Contain("defaultLiveMessage=DefaultLiveMessage")); + Assert.That(restRequest.Value.Resource, !Does.Contain("defaultMachineMessage=DefaultMachineMessage")); + Assert.That(restRequest.Value.Resource, !Does.Contain("defaultLiveMessageSoundId=1")); + Assert.That(restRequest.Value.Resource, !Does.Contain("defaultMachineMessageSoundId=1")); + Assert.That(restRequest.Value.Resource, !Does.Contain("defaultMachineMessageSoundId=1")); + Assert.That(restRequest.Value.Resource, !Does.Contain("defaultVoice=FRENCHCANADIAN1")); + Assert.That(restRequest.Value.Resource, !Does.Contain("strictValidation=TRUE")); } [Test] @@ -131,7 +131,7 @@ public void GetCallRecordings() Assert.That(restRequest.Value.Parameters, Has.None.Matches(p => p.Name.Equals("fields"))); Assert.That(Serializer.Serialize(new ListHolder(callRecordings)), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.GET, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/calls/10/recordings")); + Assert.That(restRequest.Value.Resource, Does.Contain("/calls/10/recordings")); } [Test] @@ -144,7 +144,7 @@ public void GetCallRecordingsWithFieldsParam() Assert.That(Serializer.Serialize(new ListHolder(callRecordings)), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.GET, restRequest.Value.Method); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/calls/10/recordings")); + Assert.That(restRequest.Value.Resource, Does.Contain("/calls/10/recordings")); } [Test] @@ -157,7 +157,7 @@ public void GetCallRecordingByName() Assert.That(Serializer.Serialize(callRecording), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.GET, restRequest.Value.Method); Assert.That(restRequest.Value.Parameters, Has.None.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/10/recordings/testName")); + Assert.That(restRequest.Value.Resource, Does.Contain("/10/recordings/testName")); } [Test] @@ -172,7 +172,7 @@ public void GetCallRecordingByNameWithFieldsParam() Assert.That(Serializer.Serialize(callRecording), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.GET, restRequest.Value.Method); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/calls/10/recordings/testName")); + Assert.That(restRequest.Value.Resource, Does.Contain("/calls/10/recordings/testName")); } [Test] @@ -205,7 +205,7 @@ public void GetCallRecording() Assert.That(restRequest.Value.Parameters, Has.None.Matches(p => p.Name.Equals("fields"))); Assert.That(Serializer.Serialize(callRecording), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.GET, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/calls/recordings/10")); + Assert.That(restRequest.Value.Resource, Does.Contain("/calls/recordings/10")); } [Test] @@ -217,7 +217,7 @@ public void GetCallRecordingWithFieldsParam() CallRecording callRecording = Client.CallsApi.GetCallRecording(10, FIELDS); Assert.That(Serializer.Serialize(callRecording), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.GET, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/calls/recordings/10")); + Assert.That(restRequest.Value.Resource, Does.Contain("/calls/recordings/10")); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); } } diff --git a/src/CallfireApiClient.Tests/Api/CallsTexts/MediaApiTest.cs b/src/CallfireApiClient.Tests/Api/CallsTexts/MediaApiTest.cs index 4faba65..a2d85e8 100644 --- a/src/CallfireApiClient.Tests/Api/CallsTexts/MediaApiTest.cs +++ b/src/CallfireApiClient.Tests/Api/CallsTexts/MediaApiTest.cs @@ -18,7 +18,7 @@ public void Upload() string expectedJson = GetJsonPayload("/callstexts/mediaApi/response/uploadSound.json"); var restRequest = MockRestResponse(expectedJson); - string mp3FilePath = "Resources/File-examples/train.mp3"; + string mp3FilePath = GetFullPath("/Resources/File-examples/train.mp3"); ResourceId id = Client.MediaApi.Upload(mp3FilePath, "fname"); Assert.That(Serializer.Serialize(id), Is.EqualTo(expectedJson)); @@ -31,7 +31,7 @@ public void UploadWithFileData() string expectedJson = GetJsonPayload("/callstexts/mediaApi/response/uploadSound.json"); var restRequest = MockRestResponse(expectedJson); - string mp3FilePath = "Resources/File-examples/train.mp3"; + string mp3FilePath = GetFullPath("/Resources/File-examples/train.mp3"); ResourceId id = Client.MediaApi.Upload(File.ReadAllBytes(mp3FilePath), MediaType.MP3, "fname"); Assert.That(Serializer.Serialize(id), Is.EqualTo(expectedJson)); diff --git a/src/CallfireApiClient.Tests/Api/Campaigns/BatchesApiTest.cs b/src/CallfireApiClient.Tests/Api/Campaigns/BatchesApiTest.cs index 751b540..130f0fa 100644 --- a/src/CallfireApiClient.Tests/Api/Campaigns/BatchesApiTest.cs +++ b/src/CallfireApiClient.Tests/Api/Campaigns/BatchesApiTest.cs @@ -39,15 +39,15 @@ public void Update() Assert.AreEqual(Method.PUT, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.AreEqual(Serializer.Serialize(requestBodyParam.Value), requestJson); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11")); } [Test] public void UpdateNullId() { var ex = Assert.Throws(() => Client.BatchesApi.Update(new Batch())); - Assert.That(ex.Message, Is.StringContaining("Value cannot be null")); - Assert.That(ex.Message, Is.StringContaining("Parameter name: batch.id")); + Assert.That(ex.Message, Does.Contain("Value cannot be null")); + Assert.That(ex.Message, Does.Contain("Parameter name: batch.id")); } } } diff --git a/src/CallfireApiClient.Tests/Api/Campaigns/CallBroadcastsApiTest.cs b/src/CallfireApiClient.Tests/Api/Campaigns/CallBroadcastsApiTest.cs index 67d9bea..c50ef95 100644 --- a/src/CallfireApiClient.Tests/Api/Campaigns/CallBroadcastsApiTest.cs +++ b/src/CallfireApiClient.Tests/Api/Campaigns/CallBroadcastsApiTest.cs @@ -138,7 +138,7 @@ public void UpdateVoiceBroadcast() Assert.AreEqual(Method.PUT, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.AreEqual(Serializer.Serialize(requestBodyParam.Value), expectedJson); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11")); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("strictValidation") && p.Value.Equals("True"))); } @@ -160,7 +160,7 @@ public void UpdateIvrBroadcast() Assert.AreEqual(Method.PUT, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.AreEqual(Serializer.Serialize(requestBodyParam.Value), expectedJson); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/12")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/12")); } [Test] @@ -178,7 +178,7 @@ public void Get() var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.IsNull(requestBodyParam); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11")); } [Test] @@ -187,7 +187,7 @@ public void Start() var restRequest = MockRestResponse(); Client.CallBroadcastsApi.Start(10L); Assert.AreEqual(Method.POST, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/10/start")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/10/start")); } [Test] @@ -196,7 +196,7 @@ public void Stop() var restRequest = MockRestResponse(); Client.CallBroadcastsApi.Stop(10L); Assert.AreEqual(Method.POST, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/10/stop")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/10/stop")); } [Test] @@ -205,7 +205,7 @@ public void Archive() var restRequest = MockRestResponse(); Client.CallBroadcastsApi.Archive(10L); Assert.AreEqual(Method.POST, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/10/archive")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/10/archive")); } [Test] @@ -226,7 +226,7 @@ public void GetCallsWithGetByIdRequest() Assert.AreEqual(Method.GET, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.IsNull(requestBodyParam); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11/calls")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11/calls")); Assert.That(restRequest.Value.Parameters, Has.No.Some.Matches(p => p.Name.Equals("id"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("offset") && p.Value.Equals("5"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); @@ -251,7 +251,7 @@ public void GetCallsWithGetByIdAndBatchIdRequest() Assert.AreEqual(Method.GET, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.IsNull(requestBodyParam); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11/calls")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11/calls")); Assert.That(restRequest.Value.Parameters, Has.No.Some.Matches(p => p.Name.Equals("id"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("offset") && p.Value.Equals("5"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); @@ -270,12 +270,12 @@ public void GetStats() Assert.AreEqual(Method.GET, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.IsNull(requestBodyParam); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11/stats")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11/stats")); var begin = DateTime.Now.AddDays(-5d); var end = DateTime.Now; Client.CallBroadcastsApi.GetStats(11L, FIELDS, begin, end); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11/stats")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11/stats")); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); @@ -306,7 +306,7 @@ public void GetBatches() Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("offset") && p.Value.Equals("0"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); Assert.That(restRequest.Value.Parameters, Has.No.Some.Matches(p => p.Name.Equals("id"))); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11/batches")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11/batches")); } [Test] @@ -334,7 +334,7 @@ public void AddBatch() var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.That(Serializer.Serialize(requestBodyParam.Value), Is.EqualTo(requestJson)); Assert.That(restRequest.Value.Parameters, Has.No.Some.Matches(p => p.Name.Equals("campaignId"))); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/15/batches")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/15/batches")); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("strictValidation") && p.Value.Equals("True"))); } @@ -356,7 +356,7 @@ public void AddRecipients() Assert.AreEqual(Method.POST, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.That(Serializer.Serialize(requestBodyParam.Value), Is.EqualTo(requestJson)); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/15/recipients")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/15/recipients")); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("strictValidation") && p.Value.Equals("True"))); Client.CallBroadcastsApi.AddRecipients(15, recipients, FIELDS); diff --git a/src/CallfireApiClient.Tests/Api/Campaigns/CampaignSoundsApiTest.cs b/src/CallfireApiClient.Tests/Api/Campaigns/CampaignSoundsApiTest.cs index 46f0ee5..ac16780 100644 --- a/src/CallfireApiClient.Tests/Api/Campaigns/CampaignSoundsApiTest.cs +++ b/src/CallfireApiClient.Tests/Api/Campaigns/CampaignSoundsApiTest.cs @@ -47,7 +47,7 @@ public void TestDelete() Client.CampaignSoundsApi.Delete(11L); Assert.AreEqual(Method.DELETE, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11")); } [Test] @@ -61,7 +61,7 @@ public void TestGetWithFieldsParam() Assert.That(Serializer.Serialize(campaignSound), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.GET, restRequest.Value.Method); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11")); } [Test] @@ -74,7 +74,7 @@ public void TestGet() Assert.That(Serializer.Serialize(campaignSound), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.GET, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11")); } [Test] @@ -83,7 +83,7 @@ public void TestUpload() string expectedJson = GetJsonPayload("/campaigns/campaignSoundsApi/response/uploadSound.json"); var restRequest = MockRestResponse(expectedJson); - string mp3FilePath = "Resources/File-examples/train.mp3"; + string mp3FilePath = GetFullPath("/Resources/File-examples/train.mp3"); ResourceId id = Client.CampaignSoundsApi.Upload(mp3FilePath, "fname"); Assert.That(Serializer.Serialize(id), Is.EqualTo(expectedJson)); @@ -96,7 +96,7 @@ public void TestUploadAndGetSoundDetailsWithoutFileName() string expectedJson = GetJsonPayload("/campaigns/campaignSoundsApi/response/uploadSoundWithDetails.json"); var restRequest = MockRestResponse(expectedJson); - string mp3FilePath = "Resources/File-examples/train.mp3"; + string mp3FilePath = GetFullPath("/Resources/File-examples/train.mp3"); CampaignSound sound = Client.CampaignSoundsApi.UploadAndGetSoundDetails(mp3FilePath); Assert.That(Serializer.Serialize(sound), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.POST, restRequest.Value.Method); @@ -108,7 +108,7 @@ public void TestUploadAndGetSoundDetailsWithFileName() string expectedJson = GetJsonPayload("/campaigns/campaignSoundsApi/response/uploadSoundWithDetails.json"); var restRequest = MockRestResponse(expectedJson); - string mp3FilePath = "Resources/File-examples/train.mp3"; + string mp3FilePath = GetFullPath("/Resources/File-examples/train.mp3"); CampaignSound sound = Client.CampaignSoundsApi.UploadAndGetSoundDetails(mp3FilePath, "fname"); Assert.That(Serializer.Serialize(sound), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.POST, restRequest.Value.Method); @@ -120,7 +120,7 @@ public void TestUploadAndGetSoundDetailsWithFileNameAndFields() string expectedJson = GetJsonPayload("/campaigns/campaignSoundsApi/response/uploadSoundWithDetails.json"); var restRequest = MockRestResponse(expectedJson); - string mp3FilePath = "Resources/File-examples/train.mp3"; + string mp3FilePath = GetFullPath("/Resources/File-examples/train.mp3"); CampaignSound sound = Client.CampaignSoundsApi.UploadAndGetSoundDetails(mp3FilePath, "fname", FIELDS); Assert.That(restRequest.Value.Parameters, Has.None.Matches(p => p.Name.Equals("FIELDS") && p.Value.Equals(FIELDS))); Assert.That(Serializer.Serialize(sound), Is.EqualTo(expectedJson)); @@ -133,7 +133,7 @@ public void TestUploadWithFileData() string expectedJson = GetJsonPayload("/campaigns/campaignSoundsApi/response/uploadSoundWithDetails.json"); var restRequest = MockRestResponse(expectedJson); - string mp3FilePath = "Resources/File-examples/train.mp3"; + string mp3FilePath = GetFullPath("/Resources/File-examples/train.mp3"); CampaignSound sound = Client.CampaignSoundsApi.UploadAndGetSoundDetails(File.ReadAllBytes(mp3FilePath), "fname", FIELDS); Assert.That(restRequest.Value.Parameters, Has.None.Matches(p => p.Name.Equals("FIELDS") && p.Value.Equals(FIELDS))); Assert.That(Serializer.Serialize(sound), Is.EqualTo(expectedJson)); diff --git a/src/CallfireApiClient.Tests/Api/Campaigns/TextAutoRepliesApiTest.cs b/src/CallfireApiClient.Tests/Api/Campaigns/TextAutoRepliesApiTest.cs index bf354de..a19371a 100644 --- a/src/CallfireApiClient.Tests/Api/Campaigns/TextAutoRepliesApiTest.cs +++ b/src/CallfireApiClient.Tests/Api/Campaigns/TextAutoRepliesApiTest.cs @@ -76,7 +76,7 @@ public void Delete() Client.TextAutoRepliesApi.Delete(11L); Assert.AreEqual(Method.DELETE, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11")); } } } diff --git a/src/CallfireApiClient.Tests/Api/Campaigns/TextBroadcastsApiTest.cs b/src/CallfireApiClient.Tests/Api/Campaigns/TextBroadcastsApiTest.cs index 66d8306..bab9ee2 100644 --- a/src/CallfireApiClient.Tests/Api/Campaigns/TextBroadcastsApiTest.cs +++ b/src/CallfireApiClient.Tests/Api/Campaigns/TextBroadcastsApiTest.cs @@ -86,7 +86,7 @@ public void Update() Assert.AreEqual(Method.PUT, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.AreEqual(Serializer.Serialize(requestBodyParam.Value), expectedJson); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11")); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("strictValidation") && p.Value.Equals("True"))); } @@ -105,7 +105,7 @@ public void Get() var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.IsNull(requestBodyParam); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11")); } [Test] @@ -114,7 +114,7 @@ public void Start() var restRequest = MockRestResponse(); Client.TextBroadcastsApi.Start(10L); Assert.AreEqual(Method.POST, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/10/start")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/10/start")); } [Test] @@ -123,7 +123,7 @@ public void Stop() var restRequest = MockRestResponse(); Client.TextBroadcastsApi.Stop(10L); Assert.AreEqual(Method.POST, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/10/stop")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/10/stop")); } [Test] @@ -132,7 +132,7 @@ public void Archive() var restRequest = MockRestResponse(); Client.TextBroadcastsApi.Archive(10L); Assert.AreEqual(Method.POST, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/10/archive")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/10/archive")); } [Test] @@ -153,7 +153,7 @@ public void GetTextsWithGetByIdRequest() Assert.AreEqual(Method.GET, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.IsNull(requestBodyParam); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11/texts")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11/texts")); Assert.That(restRequest.Value.Parameters, Has.No.Some.Matches(p => p.Name.Equals("id"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("offset") && p.Value.Equals("5"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); @@ -178,7 +178,7 @@ public void GetTextsWithGetByIdAndBatchIdRequest() Assert.AreEqual(Method.GET, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.IsNull(requestBodyParam); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11/texts")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11/texts")); Assert.That(restRequest.Value.Parameters, Has.No.Some.Matches(p => p.Name.Equals("id"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("offset") && p.Value.Equals("5"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); @@ -197,12 +197,12 @@ public void GetStats() Assert.AreEqual(Method.GET, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.IsNull(requestBodyParam); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11/stats")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11/stats")); var begin = DateTime.Now.AddDays(-5d); var end = DateTime.Now; Client.TextBroadcastsApi.GetStats(11L, FIELDS, begin, end); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11/stats")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11/stats")); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); @@ -233,7 +233,7 @@ public void GetBatches() Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("offset") && p.Value.Equals("0"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); Assert.That(restRequest.Value.Parameters, Has.No.Some.Matches(p => p.Name.Equals("id"))); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11/batches")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11/batches")); } [Test] @@ -262,7 +262,7 @@ public void AddBatch() var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.That(Serializer.Serialize(requestBodyParam.Value), Is.EqualTo(requestJson)); Assert.That(restRequest.Value.Parameters, Has.No.Some.Matches(p => p.Name.Equals("campaignId"))); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/15/batches")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/15/batches")); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("strictValidation") && p.Value.Equals("True"))); } @@ -284,7 +284,7 @@ public void AddRecipients() Assert.AreEqual(Method.POST, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.That(Serializer.Serialize(requestBodyParam.Value), Is.EqualTo(requestJson)); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/15/recipients")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/15/recipients")); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("strictValidation") && p.Value.Equals("True"))); Client.TextBroadcastsApi.AddRecipients(15, recipients, FIELDS); diff --git a/src/CallfireApiClient.Tests/Api/Contacts/ContactListsApiTest.cs b/src/CallfireApiClient.Tests/Api/Contacts/ContactListsApiTest.cs index c2d0056..a68b03a 100644 --- a/src/CallfireApiClient.Tests/Api/Contacts/ContactListsApiTest.cs +++ b/src/CallfireApiClient.Tests/Api/Contacts/ContactListsApiTest.cs @@ -30,7 +30,7 @@ public void TestDynamicPropertiesSerializationStringNumbers() }; String serialized = Serializer.Serialize(requestString); - Assert.That(serialized, Is.StringContaining("\"contactNumbers\":")); + Assert.That(serialized, Does.Contain("\"contactNumbers\":")); } [Test] @@ -43,8 +43,8 @@ public void TestDynamicPropertiesSerializationContactIds() }; String serialized = Serializer.Serialize(requestLong); - Assert.That(serialized, Is.StringContaining("\"contactIds\":")); - Assert.That(serialized, Is.StringContaining("\"listFromIds\"")); + Assert.That(serialized, Does.Contain("\"contactIds\":")); + Assert.That(serialized, Does.Contain("\"listFromIds\"")); } [Test] @@ -58,8 +58,8 @@ public void TestDynamicPropertiesSerializationContactPojos() requestContact.Contacts = new List { c1, c2 }; String serialized = Serializer.Serialize(requestContact); - Assert.That(serialized, Is.StringContaining("\"contacts\":")); - Assert.That(serialized, Is.StringContaining("\"listFromContacts\"")); + Assert.That(serialized, Does.Contain("\"contacts\":")); + Assert.That(serialized, Does.Contain("\"listFromContacts\"")); } [Test] @@ -73,8 +73,8 @@ public void TestDynamicPropertiesSerializationWithOtherProps() }; String serialized = Serializer.Serialize(requestObjects); - Assert.That(serialized, Is.StringContaining("\"contactIds\":")); - Assert.That(serialized, Is.StringContaining("\"contactNumbersField\":\"field\"")); + Assert.That(serialized, Does.Contain("\"contactIds\":")); + Assert.That(serialized, Does.Contain("\"contactNumbersField\":\"field\"")); } [Test] @@ -130,7 +130,7 @@ public void TestCreateFromCsv() string responseJson = GetJsonPayload("/contacts/contactsApi/response/createContactList.json"); var restRequest = MockRestResponse(responseJson); - ResourceId resourceId = Client.ContactListsApi.CreateFromCsv("fileList", "Resources/File-examples/contacts1.csv", true); + ResourceId resourceId = Client.ContactListsApi.CreateFromCsv("fileList", GetFullPath("/Resources/File-examples/contacts1.csv"), true); Assert.That(Serializer.Serialize(resourceId), Is.EqualTo(responseJson)); Assert.AreEqual(Method.POST, restRequest.Value.Method); @@ -168,7 +168,7 @@ public void TestUpdateById() Client.ContactListsApi.Update(request); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/" + TEST_LONG)); + Assert.That(restRequest.Value.Resource, Does.Contain("/" + TEST_LONG)); Assert.AreEqual(Method.PUT, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.That(Serializer.Serialize(requestBodyParam.Value), Is.EqualTo(requestJson)); @@ -182,7 +182,7 @@ public void TestDelete() Client.ContactListsApi.Delete(TEST_LONG); Assert.AreEqual(Method.DELETE, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/" + TEST_LONG)); + Assert.That(restRequest.Value.Resource, Does.Contain("/" + TEST_LONG)); } [Test] @@ -246,7 +246,7 @@ public void TestAddContactsToContactListById() var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.AreEqual(Serializer.Serialize(requestBodyParam.Value), requestJson); Assert.AreEqual(Method.POST, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/" + TEST_LONG)); + Assert.That(restRequest.Value.Resource, Does.Contain("/" + TEST_LONG)); } [Test] @@ -257,8 +257,8 @@ public void RemoveListItem() Client.ContactListsApi.RemoveListItem(TEST_LONG, 123456); Assert.AreEqual(Method.DELETE, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/" + TEST_LONG)); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/123456")); + Assert.That(restRequest.Value.Resource, Does.Contain("/" + TEST_LONG)); + Assert.That(restRequest.Value.Resource, Does.Contain("/123456")); } [Test] @@ -269,7 +269,7 @@ public void RemoveListItems() Client.ContactListsApi.RemoveListItems(TEST_LONG, new List { 123456, 123457 }); Assert.AreEqual(Method.DELETE, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/" + TEST_LONG)); + Assert.That(restRequest.Value.Resource, Does.Contain("/" + TEST_LONG)); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("contactId") && p.Value.Equals("123456"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("contactId") && p.Value.Equals("123457"))); } diff --git a/src/CallfireApiClient.Tests/Api/Contacts/ContactsApiTest.cs b/src/CallfireApiClient.Tests/Api/Contacts/ContactsApiTest.cs index e550506..440d0f1 100644 --- a/src/CallfireApiClient.Tests/Api/Contacts/ContactsApiTest.cs +++ b/src/CallfireApiClient.Tests/Api/Contacts/ContactsApiTest.cs @@ -105,7 +105,7 @@ public void Update() Assert.AreEqual(Method.PUT, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.AreEqual(Serializer.Serialize(requestBodyParam.Value), requestJson); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11")); } [Test] @@ -115,7 +115,7 @@ public void Delete() Client.ContactsApi.Delete(11); Assert.AreEqual(Method.DELETE, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11")); } [Test] diff --git a/src/CallfireApiClient.Tests/Api/Contacts/DncApiTest.cs b/src/CallfireApiClient.Tests/Api/Contacts/DncApiTest.cs index 3df96de..5557dac 100644 --- a/src/CallfireApiClient.Tests/Api/Contacts/DncApiTest.cs +++ b/src/CallfireApiClient.Tests/Api/Contacts/DncApiTest.cs @@ -49,8 +49,8 @@ public void Find() public void GetByNullNumberParam() { var ex = Assert.Throws(() => Client.DncApi.Get(null)); - Assert.That(ex.Message, Is.StringContaining("Value cannot be null")); - Assert.That(ex.Message, Is.StringContaining("Parameter name: number")); + Assert.That(ex.Message, Does.Contain("Value cannot be null")); + Assert.That(ex.Message, Does.Contain("Parameter name: number")); } [Test] @@ -62,7 +62,7 @@ public void Get() var contact = Client.DncApi.Get("12135551188"); Assert.AreEqual(Method.GET, restRequest.Value.Method); Assert.That(Serializer.Serialize(contact), Is.EqualTo(expectedJson)); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/12135551188")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/12135551188")); } [Test] @@ -74,8 +74,8 @@ public void UpdateByNullNumberParam() Text = false }; var ex = Assert.Throws(() => Client.DncApi.Update(updRequest)); - Assert.That(ex.Message, Is.StringContaining("Value cannot be null")); - Assert.That(ex.Message, Is.StringContaining("Parameter name: number")); + Assert.That(ex.Message, Does.Contain("Value cannot be null")); + Assert.That(ex.Message, Does.Contain("Parameter name: number")); } [Test] @@ -95,7 +95,7 @@ public void Update() Assert.AreEqual(Method.PUT, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.AreEqual(Serializer.Serialize(requestBodyParam.Value), requestJson); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/100500")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/100500")); } [Test] @@ -122,8 +122,8 @@ public void Create() public void DeleteByNullNumberParam() { var ex = Assert.Throws(() => Client.DncApi.Delete(null)); - Assert.That(ex.Message, Is.StringContaining("Value cannot be null")); - Assert.That(ex.Message, Is.StringContaining("Parameter name: number")); + Assert.That(ex.Message, Does.Contain("Value cannot be null")); + Assert.That(ex.Message, Does.Contain("Parameter name: number")); } [Test] @@ -133,15 +133,15 @@ public void Delete() Client.DncApi.Delete("100500"); Assert.AreEqual(Method.DELETE, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/100500")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/100500")); } [Test] public void DeleteDncsFromSourceByNullSourceParam() { var ex = Assert.Throws(() => Client.DncApi.DeleteDncsFromSource(null)); - Assert.That(ex.Message, Is.StringContaining("Value cannot be null")); - Assert.That(ex.Message, Is.StringContaining("Parameter name: source")); + Assert.That(ex.Message, Does.Contain("Value cannot be null")); + Assert.That(ex.Message, Does.Contain("Parameter name: source")); } [Test] @@ -151,7 +151,7 @@ public void DeleteDncsFromSource() Client.DncApi.DeleteDncsFromSource("testSource"); Assert.AreEqual(Method.DELETE, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/testSource")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/testSource")); } [Test] @@ -172,7 +172,7 @@ public void FindUniversalDncs() Assert.NotNull(dncs); Assert.That(Serializer.Serialize(new ListHolder(dncs)), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.GET, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/12135551188")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/12135551188")); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fromNumber") && p.Value.Equals("18442800143"))); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); } diff --git a/src/CallfireApiClient.Tests/Api/Keywords/KeywordLeasesApiTest.cs b/src/CallfireApiClient.Tests/Api/Keywords/KeywordLeasesApiTest.cs index d800cce..951909a 100644 --- a/src/CallfireApiClient.Tests/Api/Keywords/KeywordLeasesApiTest.cs +++ b/src/CallfireApiClient.Tests/Api/Keywords/KeywordLeasesApiTest.cs @@ -43,12 +43,12 @@ public void Get() KeywordLease keywordLease = Client.KeywordLeasesApi.Get(TEST_STRING, FIELDS); Assert.That(Serializer.Serialize(keywordLease), Is.EqualTo(expectedJson)); Assert.AreEqual(Method.GET, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/" + TEST_STRING)); + Assert.That(restRequest.Value.Resource, Does.Contain("/" + TEST_STRING)); Assert.That(restRequest.Value.Parameters, Has.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); Client.KeywordLeasesApi.Get(TEST_STRING); Assert.That(restRequest.Value.Parameters, Has.No.Some.Matches(p => p.Name.Equals("fields") && p.Value.Equals(FIELDS))); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/" + TEST_STRING)); + Assert.That(restRequest.Value.Resource, Does.Contain("/" + TEST_STRING)); } [Test] @@ -72,7 +72,7 @@ public void Update() Client.KeywordLeasesApi.Update(keywordLease); Assert.AreEqual(Method.PUT, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringContaining("/keywords/leases/" + TEST_STRING)); + Assert.That(restRequest.Value.Resource, Does.Contain("/keywords/leases/" + TEST_STRING)); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.That(Serializer.Serialize(requestBodyParam.Value), Is.EqualTo(requestJson)); } diff --git a/src/CallfireApiClient.Tests/Api/Numbers/NumberLeasesApiTest.cs b/src/CallfireApiClient.Tests/Api/Numbers/NumberLeasesApiTest.cs index ea87470..2c87e04 100644 --- a/src/CallfireApiClient.Tests/Api/Numbers/NumberLeasesApiTest.cs +++ b/src/CallfireApiClient.Tests/Api/Numbers/NumberLeasesApiTest.cs @@ -69,7 +69,7 @@ public void Update() Assert.AreEqual(Method.PUT, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.That(Serializer.Serialize(requestBodyParam.Value), Is.EqualTo(expectedJson)); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/numbers/leases/12345678901")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/numbers/leases/12345678901")); } [Test] @@ -154,7 +154,7 @@ public void UpdateConfig() Assert.AreEqual(Method.PUT, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.That(Serializer.Serialize(requestBodyParam.Value), Is.EqualTo(expectedJson)); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/numbers/leases/configs/12345678901")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/numbers/leases/configs/12345678901")); } } } \ No newline at end of file diff --git a/src/CallfireApiClient.Tests/Api/Webhooks/WebhooksApiTest.cs b/src/CallfireApiClient.Tests/Api/Webhooks/WebhooksApiTest.cs index 454de90..c947b38 100644 --- a/src/CallfireApiClient.Tests/Api/Webhooks/WebhooksApiTest.cs +++ b/src/CallfireApiClient.Tests/Api/Webhooks/WebhooksApiTest.cs @@ -94,7 +94,7 @@ public void Update() Assert.AreEqual(Method.PUT, restRequest.Value.Method); var requestBodyParam = restRequest.Value.Parameters.FirstOrDefault(p => p.Type == ParameterType.RequestBody); Assert.AreEqual(Serializer.Serialize(requestBodyParam.Value), expectedJson); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11")); } [Test] @@ -105,7 +105,7 @@ public void Delete() Client.WebhooksApi.Delete(11L); Assert.AreEqual(Method.DELETE, restRequest.Value.Method); - Assert.That(restRequest.Value.Resource, Is.StringEnding("/11")); + Assert.That(restRequest.Value.Resource, Does.EndWith("/11")); } [Test] @@ -117,7 +117,7 @@ public void ValidateWebhook() Events = new HashSet { ResourceEvent.FINISHED, ResourceEvent.STARTED, ResourceEvent.UNKNOWN } }; var ex = Assert.Throws(() => Client.WebhooksApi.Update(webhook)); - Assert.That(ex.Message, Is.StringContaining("Event [unknown] is unsupported for CallBroadcast resource")); + Assert.That(ex.Message, Does.Contain("Event [unknown] is unsupported for CallBroadcast resource")); } [Test] diff --git a/src/CallfireApiClient.Tests/CallfireApiClient.Tests.csproj b/src/CallfireApiClient.Tests/CallfireApiClient.Tests.csproj index 3dd925e..fb63772 100644 --- a/src/CallfireApiClient.Tests/CallfireApiClient.Tests.csproj +++ b/src/CallfireApiClient.Tests/CallfireApiClient.Tests.csproj @@ -1,225 +1,227 @@ - - - - Debug - AnyCPU - {17AF49CB-38AF-484D-9151-B470F320221D} - Library - CallfireApiClient.Tests - callfire-api-client-tests - 1.0.0 - v4.6 - - - - true - full - false - bin\Debug - DEBUG; - prompt - 4 - false - false - - - full - true - bin\Release - prompt - 4 - false - false - - - + + + + + Debug + AnyCPU + {17AF49CB-38AF-484D-9151-B470F320221D} + Library + CallfireApiClient.Tests + callfire-api-client-tests + 1.0.0 + v4.6 + + + + true + full + false + bin\Debug + DEBUG; + prompt + 4 + false + false + + + full + true + bin\Release + prompt + 4 + false + false + + + + ..\..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll + True + + ..\..\packages\RestSharp.106.6.4\lib\net452\RestSharp.dll - True - - - - - ..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Always - - - Always - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Always - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {7C6961C8-3576-4499-92B6-3B5D798BDBFC} - CallfireApiClient - - - - - Always - - - - - Always - - - - - + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Always + + + Always + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Always + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {7C6961C8-3576-4499-92B6-3B5D798BDBFC} + CallfireApiClient + + + + + Always + + + + + Always + + + + + \ No newline at end of file diff --git a/src/CallfireApiClient.Tests/MockRestClient.cs b/src/CallfireApiClient.Tests/MockRestClient.cs index f9ecdc5..738bfd4 100644 --- a/src/CallfireApiClient.Tests/MockRestClient.cs +++ b/src/CallfireApiClient.Tests/MockRestClient.cs @@ -2,7 +2,6 @@ using RestSharp; using System.Reflection; using NUnit.Framework; -using System.Linq; using RestSharp.Deserializers; namespace CallfireApiClient.Tests diff --git a/src/CallfireApiClient.Tests/packages.config b/src/CallfireApiClient.Tests/packages.config index 7979e7e..f0c1648 100644 --- a/src/CallfireApiClient.Tests/packages.config +++ b/src/CallfireApiClient.Tests/packages.config @@ -1,6 +1,8 @@  - + + + \ No newline at end of file diff --git a/src/CallfireApiClient/CallfireApiClient.csproj b/src/CallfireApiClient/CallfireApiClient.csproj index ec969ef..0848eac 100644 --- a/src/CallfireApiClient/CallfireApiClient.csproj +++ b/src/CallfireApiClient/CallfireApiClient.csproj @@ -33,12 +33,12 @@ bin\Release\callfire-api-client.xml - - ..\..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll + + ..\..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll + True ..\..\packages\RestSharp.106.6.4\lib\net452\RestSharp.dll - True @@ -213,5 +213,5 @@ PreserveNewest - + \ No newline at end of file diff --git a/src/CallfireApiClient/Properties/AssemblyInfo.cs b/src/CallfireApiClient/Properties/AssemblyInfo.cs index e2c2f53..3b08194 100644 --- a/src/CallfireApiClient/Properties/AssemblyInfo.cs +++ b/src/CallfireApiClient/Properties/AssemblyInfo.cs @@ -12,7 +12,7 @@ // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. -[assembly: AssemblyVersion("1.1.28.*")] +[assembly: AssemblyVersion("1.1.29.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. diff --git a/src/CallfireApiClient/RequestFilter.cs b/src/CallfireApiClient/RequestFilter.cs index fbf3814..db1ad7a 100644 --- a/src/CallfireApiClient/RequestFilter.cs +++ b/src/CallfireApiClient/RequestFilter.cs @@ -1,7 +1,6 @@ using System; using RestSharp; - namespace CallfireApiClient { /// diff --git a/src/CallfireApiClient/packages.config b/src/CallfireApiClient/packages.config index 288b340..d63a9e0 100644 --- a/src/CallfireApiClient/packages.config +++ b/src/CallfireApiClient/packages.config @@ -1,6 +1,7 @@  - - - + + + + \ No newline at end of file From b45a7468cb03c32edaff56539fac47fa16468467 Mon Sep 17 00:00:00 2001 From: Vladimir Malinovskiy Date: Wed, 5 Jun 2019 00:04:56 +0300 Subject: [PATCH 2/2] Update readmy with dependency versions --- README.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.adoc b/README.adoc index f5dbfaf..278fc70 100644 --- a/README.adoc +++ b/README.adoc @@ -7,8 +7,8 @@ C# client for Callfire platform API version 2. See link:https://developers.callf * .NET 4.6+ .*Dependencies:* -* Newtonsoft.Json >= 7.0.1 -* RestSharp >= 106.4.2 +* Newtonsoft.Json >= 12.0.2 +* RestSharp = 106.6.4 (RestSharp have a bug with serialization to camelCase json string, wait for fix https://github.com/restsharp/RestSharp/issues/1251 before upgrade to newer) .*Table of contents* * link:https://developers.callfire.com/callfire-api-client-csharp.html[Getting Started]