From 3122494cb5b623ca40d9aa7dcfccbbf7b4d75c24 Mon Sep 17 00:00:00 2001 From: Victor Botamedi Date: Wed, 22 Mar 2017 17:27:12 -0300 Subject: [PATCH 01/21] Adding KdtSdk project.json --- KdtSdk/project.json | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 KdtSdk/project.json diff --git a/KdtSdk/project.json b/KdtSdk/project.json new file mode 100644 index 0000000..4559797 --- /dev/null +++ b/KdtSdk/project.json @@ -0,0 +1,15 @@ +{ + "dependencies": { + "System.Net.Http": "4.3.1", + "Newtonsoft.Json": "10.0.1" + }, + "frameworks": { + "netcoreapp1.0": { + "imports": [ + "dnxcore50", + "netstandard1.6" + ] + } + }, + "version": "1.0.0-*" +} From 5692c25b2f0b964fc01d5b7561f16e88691bf694 Mon Sep 17 00:00:00 2001 From: Victor Botamedi Date: Thu, 23 Mar 2017 11:28:22 -0300 Subject: [PATCH 02/21] Removing csproj and assembly info files --- .gitignore | 1 + KdtSdk/KdtSdk.csproj | 125 ----------------- KdtSdk/Properties/AssemblyInfo.cs | 36 ----- KdtSdk/packages.config | 7 - KdtSdk/project.json | 10 +- KdtTests/KdtTests.csproj | 201 ---------------------------- KdtTests/Properties/AssemblyInfo.cs | 36 ----- KdtTests/project.json | 29 ++++ 8 files changed, 37 insertions(+), 408 deletions(-) delete mode 100644 KdtSdk/KdtSdk.csproj delete mode 100644 KdtSdk/Properties/AssemblyInfo.cs delete mode 100644 KdtSdk/packages.config delete mode 100644 KdtTests/KdtTests.csproj delete mode 100644 KdtTests/Properties/AssemblyInfo.cs create mode 100644 KdtTests/project.json diff --git a/.gitignore b/.gitignore index d77b99a..7662fa4 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ *.user *.userosscache *.sln.docstates +*.lock.json # User-specific files (MonoDevelop/Xamarin Studio) *.userprefs diff --git a/KdtSdk/KdtSdk.csproj b/KdtSdk/KdtSdk.csproj deleted file mode 100644 index 619f0c9..0000000 --- a/KdtSdk/KdtSdk.csproj +++ /dev/null @@ -1,125 +0,0 @@ - - - - - Debug - AnyCPU - {10BDEBE8-3AB2-4867-931E-2E352B1E2B72} - Library - Properties - KdtSdk - KdtSdk - v4.0 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - - False - ..\packages\Newtonsoft.Json.6.0.8\lib\net40\Newtonsoft.Json.dll - - - - - ..\packages\Microsoft.Bcl.1.1.9\lib\net40\System.IO.dll - - - - ..\packages\Microsoft.Net.Http.2.2.28\lib\net40\System.Net.Http.dll - - - False - ..\packages\Microsoft.Net.Http.2.2.28\lib\net40\System.Net.Http.Extensions.dll - - - False - ..\packages\Microsoft.Net.Http.2.2.28\lib\net40\System.Net.Http.Primitives.dll - - - ..\packages\Microsoft.Net.Http.2.2.28\lib\net40\System.Net.Http.WebRequest.dll - - - ..\packages\Microsoft.Bcl.1.1.9\lib\net40\System.Runtime.dll - - - ..\packages\Microsoft.Bcl.1.1.9\lib\net40\System.Threading.Tasks.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/KdtSdk/Properties/AssemblyInfo.cs b/KdtSdk/Properties/AssemblyInfo.cs deleted file mode 100644 index e325af1..0000000 --- a/KdtSdk/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("KdtSdk")] -[assembly: AssemblyDescription("A sdk to interact with Konduto's api")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Konduto")] -[assembly: AssemblyProduct("KdtSdk")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("6d3d889c-a4cb-4919-b595-11ebdac583fb")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/KdtSdk/packages.config b/KdtSdk/packages.config deleted file mode 100644 index bf72313..0000000 --- a/KdtSdk/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/KdtSdk/project.json b/KdtSdk/project.json index 4559797..125fcf1 100644 --- a/KdtSdk/project.json +++ b/KdtSdk/project.json @@ -1,4 +1,10 @@ { + "title": "KdtSdk", + "description": "A sdk to interact with Konduto's api", + "authors": ["Konduto"], + "copyright": "Copyright © 2015", + "version": "1.0.1", + "dependencies": { "System.Net.Http": "4.3.1", "Newtonsoft.Json": "10.0.1" @@ -6,10 +12,8 @@ "frameworks": { "netcoreapp1.0": { "imports": [ - "dnxcore50", "netstandard1.6" ] } - }, - "version": "1.0.0-*" + } } diff --git a/KdtTests/KdtTests.csproj b/KdtTests/KdtTests.csproj deleted file mode 100644 index 6bfafda..0000000 --- a/KdtTests/KdtTests.csproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - Debug - AnyCPU - {81FEFD51-58CA-404B-9DCC-0BC9024BC4EE} - Library - Properties - KdtTests - KdtTests - v4.0 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\packages\Newtonsoft.Json.6.0.8\lib\net40\Newtonsoft.Json.dll - - - - ..\packages\Microsoft.Bcl.1.1.9\lib\net40\System.IO.dll - - - ..\packages\Microsoft.Net.Http.2.2.28\lib\net40\System.Net.Http.dll - - - False - ..\packages\Microsoft.Net.Http.2.2.28\lib\net40\System.Net.Http.Extensions.dll - - - False - ..\packages\Microsoft.Net.Http.2.2.28\lib\net40\System.Net.Http.Primitives.dll - - - ..\packages\Microsoft.Net.Http.2.2.28\lib\net40\System.Net.Http.WebRequest.dll - - - ..\packages\Microsoft.Bcl.1.1.9\lib\net40\System.Runtime.dll - - - ..\packages\Microsoft.Bcl.1.1.9\lib\net40\System.Threading.Tasks.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - True - True - Resources.resx - - - - - - ResXFileCodeGenerator - Resources.Designer.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {10bdebe8-3ab2-4867-931e-2e352b1e2b72} - KdtSdk - - - - - - - - - - - - - - - - False - - - False - - - False - - - False - - - - - - - - - - - - - \ No newline at end of file diff --git a/KdtTests/Properties/AssemblyInfo.cs b/KdtTests/Properties/AssemblyInfo.cs deleted file mode 100644 index 460e3cb..0000000 --- a/KdtTests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("KdtTests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("KdtTests")] -[assembly: AssemblyCopyright("Copyright © 2015")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("54f40858-d37b-4a5d-a7ef-a499f397279a")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/KdtTests/project.json b/KdtTests/project.json new file mode 100644 index 0000000..6c74ea5 --- /dev/null +++ b/KdtTests/project.json @@ -0,0 +1,29 @@ +{ + "title": "KdtTests", + "authors": ["Konduto"], + "copyright": "Copyright © 2015", + "version": "1.0.1", + + "testRunner": "xunit", + "dependencies": { + "xunit": "2.2.0-beta2-build3300", + "dotnet-test-xunit": "2.2.0-preview2-build1029", + "System.Diagnostics.TraceSource": "4.0.0-rc2-24027" + }, + "frameworks": { + "netcoreapp1.0": { + "imports": [ + "dotnet5.6", + "dnxcore50", + "portable-net45+win8", + "netstandard1.6" + ], + "dependencies": { + "Microsoft.NETCore.App": { + "type": "platform", + "version": "1.0.0" + } + } + } + } +} From 0862ea221e4c80f6c1b27b338bbbcd4a45611921 Mon Sep 17 00:00:00 2001 From: Victor Botamedi Date: Thu, 23 Mar 2017 11:29:07 -0300 Subject: [PATCH 03/21] Building in netcore 1 --- KdtSdk/Konduto.cs | 23 ++--------------------- KdtSdk/Utils/KondutoUtils.cs | 3 ++- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/KdtSdk/Konduto.cs b/KdtSdk/Konduto.cs index 672068d..e29e6bd 100644 --- a/KdtSdk/Konduto.cs +++ b/KdtSdk/Konduto.cs @@ -7,7 +7,6 @@ using KdtSdk.Exceptions; using System.Net.Http.Headers; using Newtonsoft.Json.Linq; -using System.Net; namespace KdtSdk { @@ -151,27 +150,9 @@ public void SetProxy(String proxyAddress, String proxyUser, String proxyPassword /// private HttpClient CreateHttpClient() { - String base64 = Base64Encode(apiKey); + var base64 = Base64Encode(apiKey); - HttpClient httpClient; - - if (!this.useProxy) - { - httpClient = __MessageHandler == null ? new HttpClient() : new HttpClient(__MessageHandler); - } - else - { - var httpClientHandler = new HttpClientHandler - { - UseDefaultCredentials = false, - Proxy = new WebProxy(this.proxyAddress, false, null, new NetworkCredential(this.proxyUsername, this.proxyPassword)), - UseProxy = true - }; - - //httpClient = HttpClientFactory.Create(httpClientHandler); - httpClient = new HttpClient(httpClientHandler); - } - + var httpClient = __MessageHandler == null ? new HttpClient() : new HttpClient(__MessageHandler); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); httpClient.DefaultRequestHeaders.Add("Authorization", "Basic " + base64); httpClient.DefaultRequestHeaders.Add("X-Requested-With", "Konduto SDK .NET " + VERSION); diff --git a/KdtSdk/Utils/KondutoUtils.cs b/KdtSdk/Utils/KondutoUtils.cs index 1d87ded..bc9b532 100644 --- a/KdtSdk/Utils/KondutoUtils.cs +++ b/KdtSdk/Utils/KondutoUtils.cs @@ -5,6 +5,7 @@ using Newtonsoft.Json.Converters; +using System.Reflection; namespace KdtSdk.Utils { @@ -82,7 +83,7 @@ public abstract class JsonCreationConverter : JsonConverter public override bool CanConvert(Type objectType) { - return typeof(T).IsAssignableFrom(objectType); + return typeof(T).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); } public override object ReadJson(JsonReader reader, From 1bd6ab6e627337a95ab678dec6181efbe824a0e3 Mon Sep 17 00:00:00 2001 From: Victor Botamedi Date: Thu, 23 Mar 2017 15:48:54 -0300 Subject: [PATCH 04/21] Porting test project --- .../KondutoHTTPExceptionFactoryTest.cs | 9 +- .../Exceptions/KondutoHTTPExceptionTest.cs | 7 +- .../KondutoInvalidEntityExceptionTest.cs | 9 +- .../KondutoUnexpectedAPIResponseTest.cs | 7 +- KdtTests/KondutoTest.cs | 193 ++++------ KdtTests/Models/KondutoAddressTest.cs | 14 +- KdtTests/Models/KondutoBoletoPaymentTest.cs | 13 +- KdtTests/Models/KondutoCustomerTest.cs | 12 +- KdtTests/Models/KondutoDeviceTest.cs | 14 +- KdtTests/Models/KondutoGeolocationTest.cs | 14 +- KdtTests/Models/KondutoItemTest.cs | 16 +- KdtTests/Models/KondutoNavigationInfoTest.cs | 14 +- KdtTests/Models/KondutoOrderTest.cs | 34 +- KdtTests/Models/KondutoPassengerTest.cs | 14 +- KdtTests/Models/KondutoPaymentTest.cs | 54 +-- KdtTests/Models/KondutoSellerTest.cs | 17 +- KdtTests/Models/KondutoTravelTest.cs | 14 +- KdtTests/Properties/Resources.Designer.cs | 346 ------------------ KdtTests/Properties/Resources.cs | 21 ++ KdtTests/Properties/Resources.resx | 160 -------- KdtTests/project.json | 8 + 21 files changed, 236 insertions(+), 754 deletions(-) delete mode 100644 KdtTests/Properties/Resources.Designer.cs create mode 100644 KdtTests/Properties/Resources.cs delete mode 100644 KdtTests/Properties/Resources.resx diff --git a/KdtTests/Exceptions/KondutoHTTPExceptionFactoryTest.cs b/KdtTests/Exceptions/KondutoHTTPExceptionFactoryTest.cs index 9a9bf37..1385480 100644 --- a/KdtTests/Exceptions/KondutoHTTPExceptionFactoryTest.cs +++ b/KdtTests/Exceptions/KondutoHTTPExceptionFactoryTest.cs @@ -1,11 +1,10 @@ using KdtSdk.Exceptions; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; +using Xunit; namespace KdtTests.Exceptions { - [TestClass] public class KondutoHTTPExceptionFactoryTest { private static Dictionary HTTP_STATUSES = new Dictionary() @@ -20,17 +19,17 @@ public class KondutoHTTPExceptionFactoryTest {500, typeof(KdtSdk.Exceptions.KondutoHTTPExceptionFactory.KondutoHTTPInternalErrorException)} }; - [TestMethod] + [Fact] public void BuildExceptionTest() { foreach (var entry in HTTP_STATUSES) { int statusCode = entry.Key; - var klass = entry.Value; + var type = entry.Value; String responseBody = "{\"statusCode\": \"" + statusCode + "\"}"; var exception = KondutoHTTPExceptionFactory.buildException(statusCode, responseBody); - Assert.IsTrue(klass == exception.GetType()); + Assert.Equal(type, exception.GetType()); } } } diff --git a/KdtTests/Exceptions/KondutoHTTPExceptionTest.cs b/KdtTests/Exceptions/KondutoHTTPExceptionTest.cs index 5973d69..15f0a47 100644 --- a/KdtTests/Exceptions/KondutoHTTPExceptionTest.cs +++ b/KdtTests/Exceptions/KondutoHTTPExceptionTest.cs @@ -1,10 +1,9 @@ using KdtSdk.Exceptions; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using Xunit; namespace KdtTests.Exceptions { - [TestClass] public class KondutoHTTPExceptionTest { private class KondutoFakeHTTPException : KondutoHTTPException @@ -13,14 +12,14 @@ public KondutoFakeHTTPException(String message, String responseBody) : base(message, responseBody) { } } - [TestMethod] + [Fact] public void ConstructorTest() { String message = "fake message"; String json = ""; KondutoFakeHTTPException fakeException = new KondutoFakeHTTPException(message, json); - Assert.AreEqual(fakeException.Message, String.Format("{0} Response body: {1}", message, json)); + Assert.Equal(fakeException.Message, $"{message} Response body: {json}"); } } } diff --git a/KdtTests/Exceptions/KondutoInvalidEntityExceptionTest.cs b/KdtTests/Exceptions/KondutoInvalidEntityExceptionTest.cs index 5110794..4f9d7ba 100644 --- a/KdtTests/Exceptions/KondutoInvalidEntityExceptionTest.cs +++ b/KdtTests/Exceptions/KondutoInvalidEntityExceptionTest.cs @@ -1,22 +1,19 @@ using KdtSdk.Exceptions; using KdtSdk.Models; -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System; +using Xunit; namespace KdtTests.Exceptions { - [TestClass] public class KondutoInvalidEntityExceptionTest { - [TestMethod] + [Fact] public void InvalidEntityExceptionMessageTest() { KondutoCustomer customer = new KondutoCustomer(); customer.IsValid(); // triggers errors KondutoInvalidEntityException exception = new KondutoInvalidEntityException(customer); - Assert.AreEqual(String.Format("{0} is invalid: {1}", customer.ToString(), customer.GetError()), - exception.Message, "incorrect expected exception message"); + Assert.Equal($"{customer} is invalid: {customer.GetError()}", exception.Message); } } } diff --git a/KdtTests/Exceptions/KondutoUnexpectedAPIResponseTest.cs b/KdtTests/Exceptions/KondutoUnexpectedAPIResponseTest.cs index 749c28c..090c08a 100644 --- a/KdtTests/Exceptions/KondutoUnexpectedAPIResponseTest.cs +++ b/KdtTests/Exceptions/KondutoUnexpectedAPIResponseTest.cs @@ -1,19 +1,18 @@ using System; -using Microsoft.VisualStudio.TestTools.UnitTesting; using KdtSdk.Exceptions; +using Xunit; namespace KdtTests.Exceptions { - [TestClass] public class KondutoUnexpectedAPIResponseExceptionTest { - [TestMethod] + [Fact] public void GetMessageTest() { String responseBody = ""; KondutoUnexpectedAPIResponseException e = new KondutoUnexpectedAPIResponseException(responseBody); - Assert.AreEqual("Unexpected API response: " + responseBody, e.Message); + Assert.Equal($"Unexpected API response: {responseBody}", e.Message); } } } diff --git a/KdtTests/KondutoTest.cs b/KdtTests/KondutoTest.cs index b3f15e6..230366e 100644 --- a/KdtTests/KondutoTest.cs +++ b/KdtTests/KondutoTest.cs @@ -2,7 +2,6 @@ using KdtSdk.Exceptions; using KdtSdk.Models; using KdtTests.Factories; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; @@ -10,11 +9,11 @@ using System.Net; using System.Net.Http; using System.Threading.Tasks; - +using Xunit; +using KdtTests.Properties; namespace KdtTests { - [TestClass] public class KondutoTest { //static String AUTH_HEADER = "Basic VDczOEQ1MTZGMDlDQUIzQTJDMUVF"; @@ -41,13 +40,12 @@ public class KondutoTest private Konduto konduto; - [TestInitialize] - public void Setup() + public KondutoTest() { konduto = new Konduto(API_KEY); ANALYZE_ORDER_RESPONSE = JsonConvert.DeserializeObject( - Properties.Resources.konduto_order); + Resources.Load("konduto_order")); JToken jt; ANALYZE_ORDER_RESPONSE.TryGetValue("order", out jt); @@ -55,43 +53,10 @@ public void Setup() ORDER_ID = ORDER_FROM_FILE.Id; NOT_ANALYZE_ORDER_RESPONSE = JsonConvert.DeserializeObject( - Properties.Resources.konduto_order_not_analyzed); + Resources.Load("konduto_order_not_analyzed")); } - //[TestMethod] - //public void TestProxy() - //{ - // Konduto konduto = new Konduto("T738D516F09CAB3A2C1EE"); - // konduto.SetProxy("192.168.0.14:808", "user1", "1234"); - - // KondutoCustomer Customer = new KondutoCustomer - // { - // Id = "28372", - // Name = "KdtUser", - // Email = "developer@example.com" - // }; - - // KondutoOrder order = new KondutoOrder - // { - // Id = ((Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds).ToString(), - // Visitor = "38a9412f0b01b4dd1762ae424169a3e490d75c7a", - // TotalAmount = 100.00, - // Customer = Customer, - // Analyze=true - // }; - - // try - // { - // konduto.Analyze(order); - // Assert.IsTrue(order.Recommendation != KondutoRecommendation.none); - // } - // catch (KondutoException ex) - // { - // Assert.Fail("Konduto exception shouldn't happen here."); - // } - //} - - [TestMethod] + [Fact] public void GetOrderSuccessfullyTest() { Konduto kdt = new Konduto(API_KEY); @@ -107,10 +72,10 @@ public void GetOrderSuccessfullyTest() var v = kdt.GetOrder(ORDER_ID); - Assert.IsTrue(ORDER_FROM_FILE.Equals(kdt.GetOrder(ORDER_ID))); + Assert.True(ORDER_FROM_FILE.Equals(kdt.GetOrder(ORDER_ID))); } - [TestMethod] + [Fact] public void GetOrderErrorTest() { foreach (int code in HTTP_STATUSES) @@ -126,7 +91,7 @@ public void GetOrderErrorTest() konduto.__MessageHandler = fakeResponseHandler; konduto.GetOrder(ORDER_ID); - Assert.Fail("Exception expected"); + Assert.True(false, "Exception expected"); } catch (KondutoHTTPException e) { @@ -134,12 +99,12 @@ public void GetOrderErrorTest() } catch (Exception e) { - Assert.Fail("KondutoHTTPException was expected"); + Assert.True(false, "KondutoHTTPException was expected"); } } } - [TestMethod] + [Fact] public void AnalyzeSuccessfullyTest() { var fakeResponseHandler = new FakeResponseHandler(); @@ -154,12 +119,12 @@ public void AnalyzeSuccessfullyTest() String s = orderToSend.ToJson(); KondutoOrder orderResponse = null; - Assert.IsTrue(orderToSend.Recommendation == KondutoRecommendation.none, "basic order should have no recommendation"); - Assert.IsTrue(orderToSend.Score == null, "basic order should have no score"); - Assert.IsNull(orderToSend.Geolocation, "basic order should have no geolocation"); - Assert.IsNull(orderToSend.Device, "basic order should have no device"); - Assert.IsNull(orderToSend.NavigationInfo, "basic order should have no navigation info"); - Assert.IsTrue(orderToSend.Analyze, "basic order should have analyze set to true"); + Assert.True(orderToSend.Recommendation == KondutoRecommendation.none, "basic order should have no recommendation"); + Assert.True(null == orderToSend.Score, "basic order should have no score"); + Assert.True(null == orderToSend.Geolocation, "basic order should have no geolocation"); + Assert.True(null == orderToSend.Device, "basic order should have no device"); + Assert.True(null == orderToSend.NavigationInfo, "basic order should have no navigation info"); + Assert.True(orderToSend.Analyze, "basic order should have analyze set to true"); try { @@ -167,15 +132,15 @@ public void AnalyzeSuccessfullyTest() } catch (KondutoInvalidEntityException e) { - Assert.Fail("order should be valid"); + Assert.True(false, "order should be valid"); } catch (KondutoUnexpectedAPIResponseException e) { - Assert.Fail("server should respond with status 200"); + Assert.True(false, "server should respond with status 200"); } catch (KondutoHTTPException e) { - Assert.Fail("server should respond with status 200"); + Assert.True(false, "server should respond with status 200"); } Double? actualScore = ORDER_FROM_FILE.Score; @@ -184,14 +149,14 @@ public void AnalyzeSuccessfullyTest() KondutoDevice actualDevice = ORDER_FROM_FILE.Device; KondutoNavigationInfo actualNavigationInfo = ORDER_FROM_FILE.NavigationInfo; - Assert.IsTrue(orderResponse.Geolocation.Equals(actualGeolocation)); - Assert.AreEqual(orderResponse.Recommendation, actualRecommendation); - Assert.AreEqual(orderResponse.Device, actualDevice); - Assert.AreEqual(orderResponse.NavigationInfo, actualNavigationInfo); - Assert.AreEqual(orderResponse.Score, actualScore); + Assert.True(orderResponse.Geolocation.Equals(actualGeolocation)); + Assert.Equal(orderResponse.Recommendation, actualRecommendation); + Assert.Equal(orderResponse.Device, actualDevice); + Assert.Equal(orderResponse.NavigationInfo, actualNavigationInfo); + Assert.Equal(orderResponse.Score, actualScore); } - [TestMethod] + [Fact] public void PostIntegrationTest() { Konduto konduto = new Konduto("T738D516F09CAB3A2C1EE"); @@ -215,15 +180,15 @@ public void PostIntegrationTest() try { konduto.Analyze(order); - Assert.IsTrue(order.Recommendation != KondutoRecommendation.none); + Assert.True(order.Recommendation != KondutoRecommendation.none); } catch (KondutoException ex) { - Assert.Fail("Konduto exception shouldn't happen here."); + Assert.True(false, "Konduto exception shouldn't happen here."); } } - [TestMethod] + [Fact] public void FullJsonIntegrationTest() { Konduto konduto = new Konduto("T738D516F09CAB3A2C1EE"); @@ -325,25 +290,25 @@ public void FullJsonIntegrationTest() try { konduto.Analyze(order); - Assert.IsTrue(order.Recommendation != KondutoRecommendation.none); + Assert.True(order.Recommendation != KondutoRecommendation.none); } catch (KondutoException ex) { - Assert.Fail("Konduto exception shouldn't happen here."); + Assert.True(false, "Konduto exception shouldn't happen here."); } try { KondutoOrder getOrder = konduto.GetOrder(order.Id); - Assert.IsNotNull(getOrder); + Assert.NotNull(getOrder); } catch (KondutoException ex) { - Assert.Fail("Konduto exception shouldn't happen here."); + Assert.True(false, "Konduto exception shouldn't happen here."); } } - [TestMethod] + [Fact] public void PostBoletoIntegrationTest() { Konduto konduto = new Konduto("T738D516F09CAB3A2C1EE"); @@ -368,15 +333,15 @@ public void PostBoletoIntegrationTest() try { konduto.Analyze(order); - Assert.IsTrue(order.Recommendation != KondutoRecommendation.none); + Assert.True(order.Recommendation != KondutoRecommendation.none); } catch (KondutoException ex) { - Assert.Fail("Konduto exception shouldn't happen here."); + Assert.True(false, "Konduto exception shouldn't happen here."); } } - [TestMethod] + [Fact] public void PostNonCreditIntegrationTest() { Konduto konduto = new Konduto("T738D516F09CAB3A2C1EE"); @@ -401,15 +366,15 @@ public void PostNonCreditIntegrationTest() try { konduto.Analyze(order); - Assert.IsTrue(order.Recommendation != KondutoRecommendation.none); + Assert.True(order.Recommendation != KondutoRecommendation.none); } catch (KondutoException ex) { - Assert.Fail("Konduto exception shouldn't happen here."); + Assert.True(false, "Konduto exception shouldn't happen here."); } } - [TestMethod] + [Fact] public void GetIntegrationTest() { Konduto konduto = new Konduto("T738D516F09CAB3A2C1EE"); @@ -420,11 +385,11 @@ public void GetIntegrationTest() } catch (KondutoException ex) { - Assert.Fail("Konduto exception shouldn't happen here."); + Assert.True(false, "Konduto exception shouldn't happen here."); } } - [TestMethod] + [Fact] public void PutIntegrationTest() { //String id = ((Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds).ToString(); @@ -451,11 +416,11 @@ public void PutIntegrationTest() try { konduto.Analyze(order); - Assert.IsTrue(order.Recommendation != KondutoRecommendation.none); + Assert.True(order.Recommendation != KondutoRecommendation.none); } catch (KondutoException ex) { - Assert.Fail("Konduto exception shouldn't happen here."); + Assert.True(false, "Konduto exception shouldn't happen here."); } try @@ -464,7 +429,7 @@ public void PutIntegrationTest() } catch (KondutoException ex) { - Assert.Fail("Konduto exception shouldn't happen here."); + Assert.True(false, "Konduto exception shouldn't happen here."); } try @@ -473,11 +438,11 @@ public void PutIntegrationTest() } catch (KondutoException ex) { - Assert.Fail("Konduto exception shouldn't happen here."); + Assert.True(false, "Konduto exception shouldn't happen here."); } catch (Exception e) { - Assert.Fail("Exception: " + e.ToString()); + Assert.True(false, "Exception: " + e.ToString()); } try @@ -486,11 +451,11 @@ public void PutIntegrationTest() } catch (KondutoException ex) { - Assert.Fail("Konduto exception shouldn't happen here."); + Assert.True(false, "Konduto exception shouldn't happen here."); } } - [TestMethod] + [Fact] public void SendOrderToKondutoButDoNotAnalyzeTest() { var fakeResponseHandler = new FakeResponseHandler(); @@ -503,7 +468,7 @@ public void SendOrderToKondutoButDoNotAnalyzeTest() KondutoOrder orderToSend = KondutoOrderFactory.basicOrder(); orderToSend.Analyze = false; - Assert.IsFalse(orderToSend.Analyze, "order analyze should be false"); + Assert.False(orderToSend.Analyze, "order analyze should be false"); try { @@ -511,23 +476,22 @@ public void SendOrderToKondutoButDoNotAnalyzeTest() } catch (KondutoInvalidEntityException e) { - Assert.Fail("order should be valid"); + Assert.True(false, "order should be valid"); } catch (KondutoHTTPException e) { - Assert.Fail("server should respond with status 200"); + Assert.True(false, "server should respond with status 200"); } catch (KondutoUnexpectedAPIResponseException e) { - Assert.Fail("server should respond with status 200"); + Assert.True(false, "server should respond with status 200"); } - Assert.IsTrue(orderToSend.Score == null); - Assert.IsTrue(orderToSend.Recommendation == KondutoRecommendation.none); - + Assert.True(orderToSend.Score == null); + Assert.True(orderToSend.Recommendation == KondutoRecommendation.none); } - [TestMethod] + [Fact] public void AnalyzeInvalidOrderTest() { var fakeResponseHandler = new FakeResponseHandler(); @@ -542,7 +506,7 @@ public void AnalyzeInvalidOrderTest() try { orderToSend = konduto.Analyze(orderToSend); // do analyze - Assert.Fail("KondutoInvalidEntityException should have been thrown"); + Assert.True(false, "KondutoInvalidEntityException should have been thrown"); } catch (KondutoInvalidEntityException e) { @@ -550,15 +514,15 @@ public void AnalyzeInvalidOrderTest() } catch (KondutoHTTPException e) { - Assert.Fail("Expected KondutoInvalidEntityException, but got KondutoHTTPException"); + Assert.True(false, "Expected KondutoInvalidEntityException, but got KondutoHTTPException"); } catch (KondutoUnexpectedAPIResponseException e) { - Assert.Fail("Expected KondutoInvalidEntityException, but got KondutoHTTPException"); + Assert.True(false, "Expected KondutoInvalidEntityException, but got KondutoHTTPException"); } } - [TestMethod] + [Fact] public void AnalyzeHTTPErrorTest() { foreach (int code in HTTP_STATUSES) @@ -574,7 +538,7 @@ public void AnalyzeHTTPErrorTest() konduto.__MessageHandler = fakeResponseHandler; konduto.Analyze(KondutoOrderFactory.basicOrder()); - Assert.Fail("Exception expected"); + Assert.True(false, "Exception expected"); } catch (KondutoHTTPException e) { @@ -582,12 +546,12 @@ public void AnalyzeHTTPErrorTest() } catch (Exception e) { - Assert.Fail("KondutoHTTPException was expected"); + Assert.True(false, "KondutoHTTPException was expected"); } } } - [TestMethod] + [Fact] public void UpdateSuccessfullyTest() { var fakeResponseHandler = new FakeResponseHandler(); @@ -603,15 +567,15 @@ public void UpdateSuccessfullyTest() } catch (KondutoHTTPException e) { - Assert.Fail("order update should have succeeded"); + Assert.True(false, "order update should have succeeded"); } catch (KondutoUnexpectedAPIResponseException e) { - Assert.Fail("order update should have succeeded"); + Assert.True(false, "order update should have succeeded"); } } - [TestMethod] + [Fact] public void UpdateHTTPErrorTest() { foreach (int code in HTTP_STATUSES) @@ -627,7 +591,7 @@ public void UpdateHTTPErrorTest() konduto.__MessageHandler = fakeResponseHandler; konduto.Analyze(KondutoOrderFactory.basicOrder()); - Assert.Fail("Exception expected"); + Assert.True(false, "Exception expected"); } catch (KondutoHTTPException e) { @@ -635,14 +599,15 @@ public void UpdateHTTPErrorTest() } catch (Exception e) { - Assert.Fail("KondutoHTTPException was expected"); + Assert.True(false, "KondutoHTTPException was expected"); } } } - [TestMethod, ExpectedException(typeof(ArgumentException))] + [Fact/*, ExpectedException(typeof(ArgumentException))*/] public void InvalidStatusWhenUpdatingTest() { + Assert.True(false, "not implemented"); List forbiddenStatus = new List() { @@ -655,39 +620,41 @@ public void InvalidStatusWhenUpdatingTest() try { konduto.UpdateOrderStatus(ORDER_FROM_FILE.Id, status, ""); - Assert.Fail("expected KondutoInvalidOrderStatus exception"); + Assert.True(false, "expected KondutoInvalidOrderStatus exception"); } catch (KondutoHTTPException e) { - Assert.Fail("expected KondutoInvalidOrderStatus exception"); + Assert.True(false, "expected KondutoInvalidOrderStatus exception"); } catch (KondutoUnexpectedAPIResponseException e) { - Assert.Fail("expected KondutoInvalidOrderStatus exception"); + Assert.True(false, "expected KondutoInvalidOrderStatus exception"); } } } - [TestMethod, ExpectedException(typeof(NullReferenceException))] + [Fact/*, ExpectedException(typeof(NullReferenceException))*/] public void NullCommentsWhenUpdatingTest() { + Assert.True(false, "not implemented"); try { konduto.UpdateOrderStatus(ORDER_FROM_FILE.Id, KondutoOrderStatus.approved, null); } catch (KondutoHTTPException e) { - Assert.Fail("expected NullPointerException"); + Assert.True(false, "expected NullPointerException"); } catch (KondutoUnexpectedAPIResponseException e) { - Assert.Fail("expected NullPointerException"); + Assert.True(false, "expected NullPointerException"); } } - [TestMethod, ExpectedException(typeof(ArgumentOutOfRangeException))] + [Fact/*, ExpectedException(typeof(ArgumentOutOfRangeException)*)*/] public void InvalidApiKeyTest() { + Assert.True(false, "not implemented"); konduto.SetApiKey("invalid key"); } @@ -704,7 +671,7 @@ protected async override Task SendAsync(HttpRequestMessage { var v = request.Headers.Authorization.Parameter; - Assert.IsTrue(AUTH_HEADER == request.Headers.Authorization.Parameter, "Failing authorizing request."); + Assert.True(AUTH_HEADER == request.Headers.Authorization.Parameter, "Failing authorizing request."); if (_FakeResponses.ContainsKey(request.RequestUri)) { diff --git a/KdtTests/Models/KondutoAddressTest.cs b/KdtTests/Models/KondutoAddressTest.cs index 40ec71b..814ff2e 100644 --- a/KdtTests/Models/KondutoAddressTest.cs +++ b/KdtTests/Models/KondutoAddressTest.cs @@ -2,18 +2,18 @@ using KdtSdk.Models; using KdtSdk.Utils; using KdtTests.Factories; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using Xunit; +using KdtTests.Properties; namespace KdtTests.Models { - [TestClass] public class KondutoAddressTest { - [TestMethod] + [Fact] public void SerializeTest() { - String expectedJSON = KondutoUtils.LoadJson(Properties.Resources.address).ToJson(); + String expectedJSON = KondutoUtils.LoadJson(Resources.Load("address")).ToJson(); String actualJSON = null; KondutoAddress address = KondutoAddressFactory.Create(); @@ -23,12 +23,12 @@ public void SerializeTest() } catch (KondutoInvalidEntityException e) { - Assert.Fail("address should be valid"); + Assert.True(false, "address should be valid"); } - Assert.AreEqual(expectedJSON, actualJSON, "address serialization failed"); + Assert.Equal(expectedJSON, actualJSON); KondutoAddress addressFromJSON = KondutoModel.FromJson(expectedJSON); - Assert.AreEqual(address, addressFromJSON, "address deserialization failed"); + Assert.Equal(address, addressFromJSON); } } } diff --git a/KdtTests/Models/KondutoBoletoPaymentTest.cs b/KdtTests/Models/KondutoBoletoPaymentTest.cs index 64c1c50..3c0c627 100644 --- a/KdtTests/Models/KondutoBoletoPaymentTest.cs +++ b/KdtTests/Models/KondutoBoletoPaymentTest.cs @@ -2,17 +2,18 @@ using KdtSdk.Models; using KdtSdk.Utils; using KdtTests.Factories; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using Xunit; +using KdtTests.Properties; namespace KdtTests.Models { public class KondutoBoletoPaymentTest { - [TestMethod] + [Fact] public void SerializeTest() { - String expectedJSON = KondutoUtils.GetFirstJArrayElement(Properties.Resources.payments); + String expectedJSON = KondutoUtils.GetFirstJArrayElement(Resources.Load("payments")); String actualJSON = null; KondutoCreditCardPayment payment = KondutoPaymentFactory.CreateCreditCardPayment(); @@ -22,13 +23,13 @@ public void SerializeTest() } catch (KondutoInvalidEntityException e) { - Assert.Fail("address should be valid"); + Assert.True(false, "address should be valid"); } - Assert.AreEqual(expectedJSON, actualJSON, "address serialization failed"); + Assert.Equal(expectedJSON, actualJSON); KondutoCreditCardPayment paymentFromJSON = KondutoModel.FromJson(expectedJSON); - Assert.AreEqual(payment, paymentFromJSON, "address deserialization failed"); + Assert.Equal(payment, paymentFromJSON); } } } diff --git a/KdtTests/Models/KondutoCustomerTest.cs b/KdtTests/Models/KondutoCustomerTest.cs index bc6f802..c00d6a8 100644 --- a/KdtTests/Models/KondutoCustomerTest.cs +++ b/KdtTests/Models/KondutoCustomerTest.cs @@ -2,32 +2,32 @@ using KdtSdk.Models; using KdtSdk.Utils; using KdtTests.Factories; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Diagnostics; +using Xunit; +using KdtTests.Properties; namespace KdtTests.Models { - [TestClass] public class KondutoCustomerTest { - [TestMethod] + [Fact] public void SerializationTest() { KondutoCustomer customer = KondutoCustomerFactory.CompleteCustomer(); - String customerJSON = KondutoUtils.LoadJson(Properties.Resources.customer).ToJson(); + String customerJSON = KondutoUtils.LoadJson(Resources.Load("customer")).ToJson(); try { var v = customer.ToJson(); - Assert.AreEqual(customerJSON, customer.ToJson(), "serialization failed"); + Assert.Equal(customerJSON, customer.ToJson()); } catch (KondutoInvalidEntityException e) { Debug.WriteLine(e.Message); } KondutoCustomer deserializedCustomer = KondutoModel.FromJson(customerJSON); - Assert.AreEqual(customer, deserializedCustomer, "deserialization failed"); + Assert.Equal(customer, deserializedCustomer); } } } \ No newline at end of file diff --git a/KdtTests/Models/KondutoDeviceTest.cs b/KdtTests/Models/KondutoDeviceTest.cs index beff4f9..f59bc29 100644 --- a/KdtTests/Models/KondutoDeviceTest.cs +++ b/KdtTests/Models/KondutoDeviceTest.cs @@ -2,30 +2,30 @@ using KdtSdk.Models; using KdtSdk.Utils; using KdtTests.Factories; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using Xunit; +using KdtTests.Properties; namespace KdtTests.Models { - [TestClass] public class KondutoDeviceTest { - [TestMethod] + [Fact] public void SerializeTest() { KondutoDevice device = KondutoDeviceFactory.Create(); - String deviceJSON = KondutoUtils.LoadJson(Properties.Resources.device).ToJson(); + String deviceJSON = KondutoUtils.LoadJson(Resources.Load("device")).ToJson(); try { - Assert.AreEqual(deviceJSON, device.ToJson(), "serialization failed"); + Assert.Equal(deviceJSON, device.ToJson()); } catch (KondutoInvalidEntityException e) { - Assert.Fail("device should be valid"); + Assert.True(false, "device should be valid"); } - Assert.AreEqual(KondutoModel.FromJson(deviceJSON), device, "deserialization failed"); + Assert.Equal(KondutoModel.FromJson(deviceJSON), device); } } } diff --git a/KdtTests/Models/KondutoGeolocationTest.cs b/KdtTests/Models/KondutoGeolocationTest.cs index 2232ebf..f3664a3 100644 --- a/KdtTests/Models/KondutoGeolocationTest.cs +++ b/KdtTests/Models/KondutoGeolocationTest.cs @@ -2,33 +2,33 @@ using KdtSdk.Models; using KdtSdk.Utils; using KdtTests.Factories; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Text; +using Xunit; +using KdtTests.Properties; namespace KdtTests.Models { - [TestClass] public class KondutoGeolocationTest { - [TestMethod] + [Fact] public void SerializationTest() { KondutoGeolocation geolocation = KondutoGeolocationFactory.Create(); - String geolocationJSON = KondutoUtils.LoadJson(Properties.Resources.geolocation).ToJson(); + String geolocationJSON = KondutoUtils.LoadJson(Resources.Load("geolocation")).ToJson(); try { - Assert.AreEqual(geolocationJSON, geolocation.ToJson(), "serialization failed"); + Assert.Equal(geolocationJSON, geolocation.ToJson()); } catch (KondutoInvalidEntityException e) { - Assert.Fail("geolocation should be valid"); + Assert.True(false, "geolocation should be valid"); } KondutoGeolocation geolocationDeserialized = KondutoModel.FromJson(geolocationJSON); - Assert.AreEqual(geolocation, geolocationDeserialized, "deserialization failed"); + Assert.Equal(geolocation, geolocationDeserialized); } } } \ No newline at end of file diff --git a/KdtTests/Models/KondutoItemTest.cs b/KdtTests/Models/KondutoItemTest.cs index cb3dd8d..b3d590f 100644 --- a/KdtTests/Models/KondutoItemTest.cs +++ b/KdtTests/Models/KondutoItemTest.cs @@ -3,34 +3,34 @@ using KdtSdk.Models; using KdtSdk.Utils; using KdtTests.Factories; -using Microsoft.VisualStudio.TestTools.UnitTesting; +using KdtTests.Properties; +using Xunit; namespace KdtTests.Models { - [TestClass] public class KondutoItemTest { KondutoItem greenTShirt = KondutoItemFactory.CreateGreenTShirt(); - String greenTShirtJSON = KondutoUtils.GetFirstJArrayElement(Properties.Resources.shopping_cart); + String greenTShirtJSON = KondutoUtils.GetFirstJArrayElement(Resources.Load("shopping_cart")); - [TestMethod] + [Fact] public void SerializationTest() { try { var v = greenTShirt.ToJson(); - Assert.AreEqual(greenTShirtJSON, greenTShirt.ToJson(), "serialization failed"); + Assert.Equal(greenTShirtJSON, greenTShirt.ToJson()); } catch (KondutoInvalidEntityException e) { - Assert.Fail("Green T-Shirt should be valid"); + Assert.True(false, "Green T-Shirt should be valid"); } } - [TestMethod] + [Fact] public void Deserializationtest() { - Assert.IsTrue(greenTShirt.Equals(KondutoModel.FromJson(greenTShirtJSON)), "deserialization failed"); + Assert.True(greenTShirt.Equals(KondutoModel.FromJson(greenTShirtJSON))); } } } diff --git a/KdtTests/Models/KondutoNavigationInfoTest.cs b/KdtTests/Models/KondutoNavigationInfoTest.cs index 38035ef..bc9f285 100644 --- a/KdtTests/Models/KondutoNavigationInfoTest.cs +++ b/KdtTests/Models/KondutoNavigationInfoTest.cs @@ -2,33 +2,33 @@ using KdtSdk.Models; using KdtSdk.Utils; using KdtTests.Factories; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using Xunit; +using KdtTests.Properties; namespace KdtTests.Models { - [TestClass] public class KondutoNavigationInfoTest { - [TestMethod] + [Fact] public void SerializationTest() { KondutoNavigationInfo navigationInfo = KondutoNavigationInfoFactory.Create(); - String navigationInfoJSON = KondutoUtils.LoadJson(Properties.Resources.navigation).ToJson(); + String navigationInfoJSON = KondutoUtils.LoadJson(Resources.Load("navigation")).ToJson(); try { var c = navigationInfo.ToJson(); - Assert.AreEqual(navigationInfoJSON ,navigationInfo.ToJson(), "serialization failed"); + Assert.Equal(navigationInfoJSON ,navigationInfo.ToJson()); } catch (KondutoInvalidEntityException e) { - Assert.Fail("navigation info should be valid"); + Assert.True(false, "navigation info should be valid"); } KondutoNavigationInfo navigationInfoDeserialized = KondutoModel.FromJson(navigationInfoJSON); - Assert.AreEqual(navigationInfoDeserialized, navigationInfo, "deserialization failed"); + Assert.Equal(navigationInfoDeserialized, navigationInfo); } } } diff --git a/KdtTests/Models/KondutoOrderTest.cs b/KdtTests/Models/KondutoOrderTest.cs index 0800695..d82dbce 100644 --- a/KdtTests/Models/KondutoOrderTest.cs +++ b/KdtTests/Models/KondutoOrderTest.cs @@ -2,52 +2,51 @@ using KdtSdk.Models; using KdtSdk.Utils; using KdtTests.Factories; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using Xunit; +using KdtTests.Properties; namespace KdtTests.Models { - [TestClass] public class KondutoOrderTest { - [TestMethod] + [Fact] public void IsValidTest() { KondutoOrder order = new KondutoOrder(); - Assert.IsFalse(order.IsValid(), "order should be invalid without id"); + Assert.False(order.IsValid(), "order should be invalid without id"); order.Id = "order1"; - Assert.IsFalse(order.IsValid(), "order should be invalid without total amount"); + Assert.False(order.IsValid(), "order should be invalid without total amount"); order.TotalAmount = 120.1; - Assert.IsFalse(order.IsValid(), "order should be invalid without customer"); + Assert.False(order.IsValid(), "order should be invalid without customer"); order.Customer = KondutoCustomerFactory.BasicCustomer(); - Assert.IsTrue(order.IsValid(), "order should be valid"); - Assert.IsTrue(order.GetError() == null, "order errors should be empty"); + Assert.True(order.IsValid(), "order should be valid"); + Assert.True(order.GetError() == null, "order errors should be empty"); } - [TestMethod] + [Fact] public void SerializationTest() { KondutoOrder order = KondutoOrderFactory.completeOrder(); - String orderJSON = KondutoUtils.LoadJson(Properties.Resources.order).ToJson(); + String orderJSON = KondutoUtils.LoadJson(Resources.Load("order")).ToJson(); try { - Assert.AreEqual(orderJSON, order.ToJson(), "serialization failed"); + Assert.Equal(orderJSON, order.ToJson()); } catch (KondutoInvalidEntityException e) { - Assert.Fail("order should be valid"); + Assert.True(false, "order should be valid"); } KondutoOrder deserializedOrder = KondutoModel.FromJson(orderJSON); - Assert.IsTrue(order.Equals(deserializedOrder), "deserialization failed"); - + Assert.True(order.Equals(deserializedOrder), "deserialization failed"); } - [TestMethod] + [Fact] public void SerializationTestWithShoppingAndFlight() { KondutoOrder order = KondutoOrderFactory.completeOrder(); @@ -56,7 +55,7 @@ public void SerializationTestWithShoppingAndFlight() try { order.ToJson(); - Assert.Fail("order should be invalid"); + Assert.True(false, "order should be invalid"); } catch (KondutoInvalidEntityException e) { @@ -69,9 +68,10 @@ public void SerializationTestWithShoppingAndFlight() //ok } - [TestMethod, ExpectedException(typeof(KondutoInvalidEntityException))] + [Fact/*, ExpectedException(typeof(KondutoInvalidEntityException))*/] public void invalidOrderSerializationThrowsExceptionTest() { + Assert.True(false, "not implemented"); KondutoOrder order = new KondutoOrder(); order.ToJson(); // triggers invalid customer exception } diff --git a/KdtTests/Models/KondutoPassengerTest.cs b/KdtTests/Models/KondutoPassengerTest.cs index 8e689e2..cd2391b 100644 --- a/KdtTests/Models/KondutoPassengerTest.cs +++ b/KdtTests/Models/KondutoPassengerTest.cs @@ -2,19 +2,19 @@ using KdtSdk.Models; using KdtSdk.Utils; using KdtTests.Factories; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Diagnostics; +using Xunit; +using KdtTests.Properties; namespace KdtTests.Models { - [TestClass] public class KondutoPassengerTest { - [TestMethod] + [Fact] public void SerializationTest() { - String expectedJSON = KondutoUtils.LoadJson(Properties.Resources.passenger).ToJson(); + String expectedJSON = KondutoUtils.LoadJson(Resources.Load("passenger")).ToJson(); String actualJSON = null; KondutoPassenger passenger = KondutoPassengerFactory.CompletePassenger(); @@ -24,12 +24,12 @@ public void SerializationTest() } catch (KondutoInvalidEntityException e) { - Assert.Fail("passenger should be valid"); + Assert.True(false, "passenger should be valid"); } - Assert.AreEqual(expectedJSON, actualJSON, "passenger serialization failed"); + Assert.Equal(expectedJSON, actualJSON); KondutoPassenger passengerFromJson = KondutoModel.FromJson(expectedJSON); - Assert.AreEqual(passenger, passengerFromJson, "passenger deserialization failed"); + Assert.Equal(passenger, passengerFromJson); } } } \ No newline at end of file diff --git a/KdtTests/Models/KondutoPaymentTest.cs b/KdtTests/Models/KondutoPaymentTest.cs index c3854d8..90dffb6 100644 --- a/KdtTests/Models/KondutoPaymentTest.cs +++ b/KdtTests/Models/KondutoPaymentTest.cs @@ -2,19 +2,19 @@ using KdtSdk.Models; using KdtSdk.Utils; using KdtTests.Factories; -using Microsoft.VisualStudio.TestTools.UnitTesting; using Newtonsoft.Json.Linq; using System; +using Xunit; +using KdtTests.Properties; namespace KdtTests.Models { - [TestClass] public class KondutoPaymentTest { - [TestMethod] + [Fact] public void CreditSerializeTest() { - String expectedJSON = KondutoUtils.GetFirstJArrayElement(Properties.Resources.payments); + String expectedJSON = KondutoUtils.GetFirstJArrayElement(Resources.Load("payments")); String actualJSON = null; KondutoCreditCardPayment payment = KondutoPaymentFactory.CreateCreditCardPayment(); @@ -24,19 +24,19 @@ public void CreditSerializeTest() } catch (KondutoInvalidEntityException e) { - Assert.Fail("address should be valid"); + Assert.True(false, "address should be valid"); } - Assert.AreEqual(expectedJSON, actualJSON, "address serialization failed"); + Assert.Equal(expectedJSON, actualJSON); KondutoCreditCardPayment paymentFromJSON = KondutoModel.FromJson(expectedJSON); - Assert.AreEqual(payment, paymentFromJSON, "address deserialization failed"); + Assert.Equal(payment, paymentFromJSON); } - [TestMethod] + [Fact] public void BoletoSerializeTest() { - JArray a = JArray.Parse(Properties.Resources.payments); + JArray a = JArray.Parse(Resources.Load("payments")); String expectedJSON = a.Last.ToString(); String actualJSON = null; KondutoBoletoPayment payment = KondutoPaymentFactory.CreateBoletoPayment(); @@ -47,19 +47,19 @@ public void BoletoSerializeTest() } catch (KondutoInvalidEntityException e) { - Assert.Fail("payment should be valid"); + Assert.True(false, "payment should be valid"); } - Assert.AreEqual(expectedJSON, actualJSON, "address serialization failed"); + Assert.Equal(expectedJSON, actualJSON); KondutoBoletoPayment paymentFromJSON = KondutoModel.FromJson(expectedJSON); - Assert.AreEqual(payment, paymentFromJSON, "payment deserialization failed"); + Assert.Equal(payment, paymentFromJSON); } - [TestMethod] + [Fact] public void DebitSerializeTest() { - JArray a = JArray.Parse(Properties.Resources.payments); + JArray a = JArray.Parse(Resources.Load("payments")); String expectedJSON = a[1].ToString(); String actualJSON = null; KondutoDebitPayment payment = KondutoPaymentFactory.CreateDebitPayment(); @@ -70,19 +70,19 @@ public void DebitSerializeTest() } catch (KondutoInvalidEntityException e) { - Assert.Fail("payment should be valid"); + Assert.True(false, "payment should be valid"); } - Assert.AreEqual(expectedJSON, actualJSON, "address serialization failed"); + Assert.Equal(expectedJSON, actualJSON); KondutoDebitPayment paymentFromJSON = KondutoModel.FromJson(expectedJSON); - Assert.AreEqual(payment, paymentFromJSON, "payment deserialization failed"); + Assert.Equal(payment, paymentFromJSON); } - [TestMethod] + [Fact] public void TransferSerializeTest() { - JArray a = JArray.Parse(Properties.Resources.payments); + JArray a = JArray.Parse(Resources.Load("payments")); String expectedJSON = a[3].ToString(); String actualJSON = null; KondutoTransferPayment payment = KondutoPaymentFactory.CreateTransferPayment(); @@ -93,19 +93,19 @@ public void TransferSerializeTest() } catch (KondutoInvalidEntityException e) { - Assert.Fail("payment should be valid"); + Assert.True(false, "payment should be valid"); } - Assert.AreEqual(expectedJSON, actualJSON, "address serialization failed"); + Assert.Equal(expectedJSON, actualJSON); KondutoTransferPayment paymentFromJSON = KondutoModel.FromJson(expectedJSON); - Assert.AreEqual(payment, paymentFromJSON, "payment deserialization failed"); + Assert.Equal(payment, paymentFromJSON); } - [TestMethod] + [Fact] public void VoucherSerializeTest() { - JArray a = JArray.Parse(Properties.Resources.payments); + JArray a = JArray.Parse(Resources.Load("payments")); String expectedJSON = a[2].ToString(); String actualJSON = null; KondutoVoucherPayment payment = KondutoPaymentFactory.CreateVoucherPayment(); @@ -116,13 +116,13 @@ public void VoucherSerializeTest() } catch (KondutoInvalidEntityException e) { - Assert.Fail("payment should be valid"); + Assert.True(false, "payment should be valid"); } - Assert.AreEqual(expectedJSON, actualJSON, "address serialization failed"); + Assert.Equal(expectedJSON, actualJSON); KondutoVoucherPayment paymentFromJSON = KondutoModel.FromJson(expectedJSON); - Assert.AreEqual(payment, paymentFromJSON, "payment deserialization failed"); + Assert.Equal(payment, paymentFromJSON); } } } \ No newline at end of file diff --git a/KdtTests/Models/KondutoSellerTest.cs b/KdtTests/Models/KondutoSellerTest.cs index 8c8b883..2c1684e 100644 --- a/KdtTests/Models/KondutoSellerTest.cs +++ b/KdtTests/Models/KondutoSellerTest.cs @@ -2,21 +2,18 @@ using KdtSdk.Models; using KdtSdk.Utils; using KdtTests.Factories; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using Xunit; +using KdtTests.Properties; namespace KdtTests.Models { - [TestClass] public class KondutoSellerTest { - [TestMethod] + [Fact] public void SerializationTest() { - String expectedJSON = KondutoUtils.LoadJson(Properties.Resources.seller).ToJson(); + String expectedJSON = KondutoUtils.LoadJson(Resources.Load("seller")).ToJson(); String actualJSON = null; KondutoSeller seller = KondutoSellerFactory.Create(); @@ -26,12 +23,12 @@ public void SerializationTest() } catch (KondutoInvalidEntityException e) { - Assert.Fail("seller should be valid"); + Assert.True(false, "seller should be valid"); } - Assert.AreEqual(expectedJSON, actualJSON, "seller serialization failed"); + Assert.Equal(expectedJSON, actualJSON); KondutoSeller sellerFromJson = KondutoModel.FromJson(expectedJSON); - Assert.AreEqual(seller, sellerFromJson, "passenger deserialization failed"); + Assert.Equal(seller, sellerFromJson); } } } diff --git a/KdtTests/Models/KondutoTravelTest.cs b/KdtTests/Models/KondutoTravelTest.cs index 709f7a8..d7e554f 100644 --- a/KdtTests/Models/KondutoTravelTest.cs +++ b/KdtTests/Models/KondutoTravelTest.cs @@ -2,18 +2,18 @@ using KdtSdk.Models; using KdtSdk.Utils; using KdtTests.Factories; -using Microsoft.VisualStudio.TestTools.UnitTesting; using System; +using Xunit; +using KdtTests.Properties; namespace KdtTests.Models { - [TestClass] public class KondutoTravelTest { - [TestMethod] + [Fact] public void SerializeTest() { - String expectedJSON = KondutoUtils.LoadJson(Properties.Resources.flight).ToJson(); + String expectedJSON = KondutoUtils.LoadJson(Resources.Load("flight")).ToJson(); String actualJSON = null; KondutoTravel flight = KondutoFlightFactory.CreateFlight(); @@ -23,12 +23,12 @@ public void SerializeTest() } catch (KondutoInvalidEntityException e) { - Assert.Fail("flight should be valid"); + Assert.True(false, "flight should be valid"); } - Assert.AreEqual(expectedJSON, actualJSON, "flight serialization failed"); + Assert.Equal(expectedJSON, actualJSON); KondutoTravel flightFromJSON = KondutoModel.FromJson(expectedJSON); - Assert.AreEqual(flight, flightFromJSON, "flight deserialization failed"); + Assert.Equal(flight, flightFromJSON); } } } diff --git a/KdtTests/Properties/Resources.Designer.cs b/KdtTests/Properties/Resources.Designer.cs deleted file mode 100644 index 02f9974..0000000 --- a/KdtTests/Properties/Resources.Designer.cs +++ /dev/null @@ -1,346 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.34014 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace KdtTests.Properties { - using System; - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - internal class Resources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal Resources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("KdtTests.Properties.Resources", typeof(Resources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - internal static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to { - /// "name":"Konduto", - /// "address1":"R. Teodoro Sampaio, 2393", - /// "address2":"CJ. 111", - /// "zip":"05406-200", - /// "city":"Sao Paulo", - /// "state":"SP", - /// "country":"BR" - ///}. - /// - internal static string address { - get { - return ResourceManager.GetString("address", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to { - /// "id":"1", - /// "name":"Jose da Silva", - /// "email":"jose.silva@gmail.com", - /// "tax_id":"01234567890", - /// "phone1":"11987654321", - /// "phone2":"1133333333", - /// "vip":false, - /// "new":false, - /// "created_at":"2014-12-21" - ///}. - /// - internal static string customer { - get { - return ResourceManager.GetString("customer", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to { - /// "user_id": "405961fab293600daeed93ae561", - /// "fingerprint": "e4f2c690951038a8f77aa583847", - /// "platform": "MacIntel", - /// "browser": "Chrome", - /// "language": "en_US", - /// "timezone": "GMT -1", - /// "cookie": true, - /// "javascript": true, - /// "flash": true, - /// "ip": "170.149.100.10" - ///}. - /// - internal static string device { - get { - return ResourceManager.GetString("device", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to { - /// "type":"flight", - /// "departure":{ - /// "origin_airport":"GRU", - /// "destination_airport":"SFO", - /// "date":"2018-12-25T18:00Z", - /// "number_of_connections":1, - /// "class":"economy", - /// "fare_basis":"Y" - /// }, - /// "return":{ - /// "origin_airport":"SFO", - /// "destination_airport":"GRU", - /// "date":"2018-12-30T18:00Z", - /// "number_of_connections":1, - /// "class":"business" - /// }, - /// "passengers":[ - /// { - /// "name":"Julia da Silva", - /// "document":"12345678909", - /// "document_type":"id", - /// "dob":"1970-01-01", - /// "nationa [rest of string was truncated]";. - /// - internal static string flight { - get { - return ResourceManager.GetString("flight", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to { - /// "city":"Sao Paulo", - /// "state":"SP", - /// "country":"BR" - ///}. - /// - internal static string geolocation { - get { - return ResourceManager.GetString("geolocation", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to { - /// "status": "ok", - /// "order": { - /// "id": "1406910391037", - /// "visitor": "f10e2821bbbea527ea02200352313bc059445190", - /// "timestamp": 1389047680, - /// "score": 0.75, - /// "recommendation": "review", - /// "status": "declined", - /// "ip": "170.149.100.10", - /// "total_amount":100.00, - /// "tax_amount":3.45, - /// "shipping_amount":20.00, - /// "installments":2, - /// "currency":"USD", - /// "device": { - /// "user_id": "405961fab293600daeed93ae561", - /// "fingerprint": "e4f2c690951038a8f77aa583847", - /// "platform": "MacIntel", - /// [rest of string was truncated]";. - /// - internal static string konduto_order { - get { - return ResourceManager.GetString("konduto_order", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to { - /// "status":"ok", - /// "order":{ - /// "id":"1422044664262", - /// "visitor":"da39a3ee5e6b4b0d3255bfef95601890afd80709", - /// "score":-1.0, - /// "recommendation":"NONE", - /// "ip":"170.149.100.10" - /// } - ///}. - /// - internal static string konduto_order_not_analyzed { - get { - return ResourceManager.GetString("konduto_order_not_analyzed", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to { - /// "session_time": 12, - /// "referrer": "http://www.google.com?q=buy+shirt", - /// "time_site_1d": 26, - /// "new_accounts_1d": 2, - /// "password_resets_1d": 0, - /// "sales_declined_1d": 1, - /// "sessions_1d": 4, - /// "time_site_7d": 58, - /// "time_per_page_7d": 7, - /// "new_accounts_7d": 9, - /// "password_resets_7d": 3, - /// "checkout_count_7d": 4, - /// "sales_declined_7d": 5, - /// "sessions_7d": 12, - /// "time_since_last_sale": 4 - ///}. - /// - internal static string navigation { - get { - return ResourceManager.GetString("navigation", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to { - /// "id":"1", - /// "visitor":"a9031kdlas", - /// "timestamp":123123123123, - /// "total_amount":120.5, - /// "shipping_amount":5.0, - /// "tax_amount":3.0, - /// "currency":"USD", - /// "installments":1, - /// "ip":"192.168.0.1", - /// "customer":{ - /// "id":"1", - /// "name":"Jose da Silva", - /// "email":"jose.silva@gmail.com", - /// "tax_id":"01234567890", - /// "phone1":"11987654321", - /// "phone2":"1133333333", - /// "vip":false, - /// "new":false - /// }, - /// "recommendation":"approve", - /// "geolocation":{ - /// "ci [rest of string was truncated]";. - /// - internal static string order { - get { - return ResourceManager.GetString("order", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to { - /// "name": "Carlos Siqueira", - /// "document": "XYZ1234", - /// "document_type": "passport", - /// "dob": "1970-12-01", - /// "nationality": "US", - /// "frequent_passenger": false, - /// "special_needs": true, - /// "loyalty": { - /// "program": "multiplus", - /// "category": "silver" - /// } - ///}. - /// - internal static string passenger { - get { - return ResourceManager.GetString("passenger", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to [ - /// { - /// "bin":"1234", - /// "last4":"1234", - /// "expiration_date":"010214", - /// "status":"approved", - /// "type":"credit" - /// }, - /// { - /// "expiration_date":"010214", - /// "type": "boleto" - /// } - ///]. - /// - internal static string payments { - get { - return ResourceManager.GetString("payments", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to https://github.com/konduto/dotnet-sdk.git. - /// - internal static string seller { - get { - return ResourceManager.GetString("seller", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to [ - /// { - /// "sku": "9919023", - /// "category": 201, - /// "name": "Green T-Shirt", - /// "description": "Male Green T-Shirt V Neck", - /// "product_code": "123456789999", - /// "unit_cost": 1999.99, - /// "quantity": 1.0, - /// "created_at": "2014-12-21" - /// }, - /// { - /// "sku": "0017273", - /// "category": 202, - /// "name": "Yellow Socks", - /// "description": "Pair of Yellow Socks", - /// "unit_cost": 29.90, - /// "quantity": 2.0, - /// "discount": 5.00 - /// } - ///]. - /// - internal static string shopping_cart { - get { - return ResourceManager.GetString("shopping_cart", resourceCulture); - } - } - } -} diff --git a/KdtTests/Properties/Resources.cs b/KdtTests/Properties/Resources.cs new file mode 100644 index 0000000..7f805ef --- /dev/null +++ b/KdtTests/Properties/Resources.cs @@ -0,0 +1,21 @@ +using System.IO; +using System.Reflection; + +namespace KdtTests.Properties +{ + internal static class Resources + { + /// + /// Loads an embed resource file + /// + /// File name + /// File extension + /// String + internal static string Load(string name, string extension = "txt") + { + var assembly = typeof(Resources).GetTypeInfo().Assembly; + var resource = assembly.GetManifestResourceStream($"KdtTests.Resources.{name}.{extension}"); + return new StreamReader(resource).ReadToEnd(); + } + } +} diff --git a/KdtTests/Properties/Resources.resx b/KdtTests/Properties/Resources.resx deleted file mode 100644 index c8eea9f..0000000 --- a/KdtTests/Properties/Resources.resx +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - ..\Resources\address.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ..\Resources\customer.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ..\Resources\device.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - - ..\Resources\flight.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - - ..\Resources\geolocation.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ..\Resources\konduto_order.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - - ..\Resources\order_not_analyzed.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - - ..\Resources\navigation.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - - ..\Resources\order.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 - - - ..\Resources\passenger.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - - ..\Resources\payments.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - - ..\Resources\seller.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - - ..\Resources\shopping_cart.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 - - \ No newline at end of file diff --git a/KdtTests/project.json b/KdtTests/project.json index 6c74ea5..5721229 100644 --- a/KdtTests/project.json +++ b/KdtTests/project.json @@ -6,10 +6,18 @@ "testRunner": "xunit", "dependencies": { + "KdtSdk": "1.0.1", "xunit": "2.2.0-beta2-build3300", "dotnet-test-xunit": "2.2.0-preview2-build1029", "System.Diagnostics.TraceSource": "4.0.0-rc2-24027" }, + "buildOptions": { + "embed": { + "include": [ + "Resources/*.txt" + ] + } + }, "frameworks": { "netcoreapp1.0": { "imports": [ From 58130e806991d1edb947d2dbc45097ee8a494604 Mon Sep 17 00:00:00 2001 From: Victor Botamedi Date: Thu, 23 Mar 2017 16:38:46 -0300 Subject: [PATCH 05/21] Implementing exception tests --- KdtTests/KondutoTest.cs | 79 +++++++---------------------- KdtTests/Models/KondutoOrderTest.cs | 5 +- 2 files changed, 20 insertions(+), 64 deletions(-) diff --git a/KdtTests/KondutoTest.cs b/KdtTests/KondutoTest.cs index 230366e..ecdcb88 100644 --- a/KdtTests/KondutoTest.cs +++ b/KdtTests/KondutoTest.cs @@ -53,7 +53,7 @@ public KondutoTest() ORDER_ID = ORDER_FROM_FILE.Id; NOT_ANALYZE_ORDER_RESPONSE = JsonConvert.DeserializeObject( - Resources.Load("konduto_order_not_analyzed")); + Resources.Load("order_not_analyzed")); } [Fact] @@ -392,9 +392,7 @@ public void GetIntegrationTest() [Fact] public void PutIntegrationTest() { - //String id = ((Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds).ToString(); - String id = "1429744771"; - + var id = $"{((Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds)}"; Konduto konduto = new Konduto("T738D516F09CAB3A2C1EE"); KondutoCustomer Customer = new KondutoCustomer @@ -420,7 +418,7 @@ public void PutIntegrationTest() } catch (KondutoException ex) { - Assert.True(false, "Konduto exception shouldn't happen here."); + Assert.True(false, $"Konduto exception shouldn't happen here. {ex.Message}"); } try @@ -451,7 +449,7 @@ public void PutIntegrationTest() } catch (KondutoException ex) { - Assert.True(false, "Konduto exception shouldn't happen here."); + Assert.True(false, $"Konduto exception shouldn't happen here. {ex.Message}"); } } @@ -580,82 +578,41 @@ public void UpdateHTTPErrorTest() { foreach (int code in HTTP_STATUSES) { - try - { - var fakeResponseHandler = new FakeResponseHandler(); + var fakeResponseHandler = new FakeResponseHandler(); - var message = new HttpResponseMessage((HttpStatusCode)code); - message.Content = new StringContent("{}"); - - fakeResponseHandler.AddFakeResponse(konduto.KondutoPutOrderUrl(ORDER_ID), message); - konduto.__MessageHandler = fakeResponseHandler; + var message = new HttpResponseMessage((HttpStatusCode)code); + message.Content = new StringContent("{}"); - konduto.Analyze(KondutoOrderFactory.basicOrder()); - Assert.True(false, "Exception expected"); - } - catch (KondutoHTTPException e) - { - //Ok - } - catch (Exception e) - { - Assert.True(false, "KondutoHTTPException was expected"); - } + fakeResponseHandler.AddFakeResponse(konduto.KondutoPutOrderUrl(ORDER_ID), message); + konduto.__MessageHandler = fakeResponseHandler; + Assert.ThrowsAny(() => konduto.Analyze(KondutoOrderFactory.basicOrder())); } } - [Fact/*, ExpectedException(typeof(ArgumentException))*/] + [Fact] public void InvalidStatusWhenUpdatingTest() { - Assert.True(false, "not implemented"); List forbiddenStatus = new List() { KondutoOrderStatus.not_analyzed, KondutoOrderStatus.pending }; - - foreach (KondutoOrderStatus status in forbiddenStatus) - { - try - { - konduto.UpdateOrderStatus(ORDER_FROM_FILE.Id, status, ""); - Assert.True(false, "expected KondutoInvalidOrderStatus exception"); - } - catch (KondutoHTTPException e) - { - Assert.True(false, "expected KondutoInvalidOrderStatus exception"); - } - catch (KondutoUnexpectedAPIResponseException e) - { - Assert.True(false, "expected KondutoInvalidOrderStatus exception"); - } - } + foreach (var status in forbiddenStatus) + Assert.Throws(() => konduto.UpdateOrderStatus(ORDER_FROM_FILE.Id, status, "")); } - [Fact/*, ExpectedException(typeof(NullReferenceException))*/] + [Fact] public void NullCommentsWhenUpdatingTest() { - Assert.True(false, "not implemented"); - try - { - konduto.UpdateOrderStatus(ORDER_FROM_FILE.Id, KondutoOrderStatus.approved, null); - } - catch (KondutoHTTPException e) - { - Assert.True(false, "expected NullPointerException"); - } - catch (KondutoUnexpectedAPIResponseException e) - { - Assert.True(false, "expected NullPointerException"); - } + Assert.Throws(() => + konduto.UpdateOrderStatus(ORDER_FROM_FILE.Id, KondutoOrderStatus.approved, null)); } - [Fact/*, ExpectedException(typeof(ArgumentOutOfRangeException)*)*/] + [Fact] public void InvalidApiKeyTest() { - Assert.True(false, "not implemented"); - konduto.SetApiKey("invalid key"); + Assert.Throws(() => konduto.SetApiKey("invalid key")); } private class FakeResponseHandler : DelegatingHandler diff --git a/KdtTests/Models/KondutoOrderTest.cs b/KdtTests/Models/KondutoOrderTest.cs index d82dbce..ae0efa4 100644 --- a/KdtTests/Models/KondutoOrderTest.cs +++ b/KdtTests/Models/KondutoOrderTest.cs @@ -68,12 +68,11 @@ public void SerializationTestWithShoppingAndFlight() //ok } - [Fact/*, ExpectedException(typeof(KondutoInvalidEntityException))*/] + [Fact] public void invalidOrderSerializationThrowsExceptionTest() { - Assert.True(false, "not implemented"); KondutoOrder order = new KondutoOrder(); - order.ToJson(); // triggers invalid customer exception + Assert.Throws(() => order.ToJson()); } } } From 7770068f97346ba61d912b95f73072db8f685b19 Mon Sep 17 00:00:00 2001 From: Victor Botamedi Date: Thu, 23 Mar 2017 17:29:41 -0300 Subject: [PATCH 06/21] Removing unnecessary try catch blocks --- KdtTests/KondutoTest.cs | 242 +++---------------- KdtTests/Models/KondutoAddressTest.cs | 13 +- KdtTests/Models/KondutoBoletoPaymentTest.cs | 12 +- KdtTests/Models/KondutoCustomerTest.cs | 17 +- KdtTests/Models/KondutoDeviceTest.cs | 11 +- KdtTests/Models/KondutoGeolocationTest.cs | 10 +- KdtTests/Models/KondutoItemTest.cs | 10 +- KdtTests/Models/KondutoNavigationInfoTest.cs | 12 +- KdtTests/Models/KondutoOrderTest.cs | 24 +- KdtTests/Models/KondutoPassengerTest.cs | 13 +- KdtTests/Models/KondutoPaymentTest.cs | 12 +- KdtTests/Models/KondutoSellerTest.cs | 11 +- KdtTests/Models/KondutoTravelTest.cs | 11 +- 13 files changed, 57 insertions(+), 341 deletions(-) diff --git a/KdtTests/KondutoTest.cs b/KdtTests/KondutoTest.cs index ecdcb88..72543e9 100644 --- a/KdtTests/KondutoTest.cs +++ b/KdtTests/KondutoTest.cs @@ -80,27 +80,14 @@ public void GetOrderErrorTest() { foreach (int code in HTTP_STATUSES) { - try - { - var fakeResponseHandler = new FakeResponseHandler(); - - var message = new HttpResponseMessage((HttpStatusCode)code); - message.Content = new StringContent(ORDER_FROM_FILE.ToJson()); + var fakeResponseHandler = new FakeResponseHandler(); - fakeResponseHandler.AddFakeResponse(konduto.KondutoGetOrderUrl(ORDER_ID), message); - konduto.__MessageHandler = fakeResponseHandler; + var message = new HttpResponseMessage((HttpStatusCode)code); + message.Content = new StringContent(ORDER_FROM_FILE.ToJson()); - konduto.GetOrder(ORDER_ID); - Assert.True(false, "Exception expected"); - } - catch (KondutoHTTPException e) - { - //Ok - } - catch (Exception e) - { - Assert.True(false, "KondutoHTTPException was expected"); - } + fakeResponseHandler.AddFakeResponse(konduto.KondutoGetOrderUrl(ORDER_ID), message); + konduto.__MessageHandler = fakeResponseHandler; + Assert.ThrowsAny(() => konduto.GetOrder(ORDER_ID)); } } @@ -126,23 +113,8 @@ public void AnalyzeSuccessfullyTest() Assert.True(null == orderToSend.NavigationInfo, "basic order should have no navigation info"); Assert.True(orderToSend.Analyze, "basic order should have analyze set to true"); - try - { - orderResponse = konduto.Analyze(orderToSend); // do analyze - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "order should be valid"); - } - catch (KondutoUnexpectedAPIResponseException e) - { - Assert.True(false, "server should respond with status 200"); - } - catch (KondutoHTTPException e) - { - Assert.True(false, "server should respond with status 200"); - } + orderResponse = konduto.Analyze(orderToSend); Double? actualScore = ORDER_FROM_FILE.Score; KondutoRecommendation? actualRecommendation = ORDER_FROM_FILE.Recommendation; KondutoGeolocation actualGeolocation = ORDER_FROM_FILE.Geolocation; @@ -176,16 +148,8 @@ public void PostIntegrationTest() Customer = Customer, Analyze = true }; - - try - { - konduto.Analyze(order); - Assert.True(order.Recommendation != KondutoRecommendation.none); - } - catch (KondutoException ex) - { - Assert.True(false, "Konduto exception shouldn't happen here."); - } + konduto.Analyze(order); + Assert.True(order.Recommendation != KondutoRecommendation.none); } [Fact] @@ -286,26 +250,10 @@ public void FullJsonIntegrationTest() }, Analyze = true }; - - try - { - konduto.Analyze(order); - Assert.True(order.Recommendation != KondutoRecommendation.none); - } - catch (KondutoException ex) - { - Assert.True(false, "Konduto exception shouldn't happen here."); - } - - try - { - KondutoOrder getOrder = konduto.GetOrder(order.Id); - Assert.NotNull(getOrder); - } - catch (KondutoException ex) - { - Assert.True(false, "Konduto exception shouldn't happen here."); - } + konduto.Analyze(order); + Assert.True(order.Recommendation != KondutoRecommendation.none); + var getOrder = konduto.GetOrder(order.Id); + Assert.NotNull(getOrder); } [Fact] @@ -329,16 +277,8 @@ public void PostBoletoIntegrationTest() Payments = KondutoPaymentFactory.CreatePayments(), Analyze = true }; - - try - { - konduto.Analyze(order); - Assert.True(order.Recommendation != KondutoRecommendation.none); - } - catch (KondutoException ex) - { - Assert.True(false, "Konduto exception shouldn't happen here."); - } + konduto.Analyze(order); + Assert.True(order.Recommendation != KondutoRecommendation.none); } [Fact] @@ -363,30 +303,16 @@ public void PostNonCreditIntegrationTest() Analyze = true }; - try - { - konduto.Analyze(order); - Assert.True(order.Recommendation != KondutoRecommendation.none); - } - catch (KondutoException ex) - { - Assert.True(false, "Konduto exception shouldn't happen here."); - } + konduto.Analyze(order); + Assert.True(order.Recommendation != KondutoRecommendation.none); } [Fact] public void GetIntegrationTest() { - Konduto konduto = new Konduto("T738D516F09CAB3A2C1EE"); - - try - { - KondutoOrder order = konduto.GetOrder("1429744771"); - } - catch (KondutoException ex) - { - Assert.True(false, "Konduto exception shouldn't happen here."); - } + var konduto = new Konduto("T738D516F09CAB3A2C1EE"); + var order = konduto.GetOrder("1429744771"); + Assert.NotNull(order); } [Fact] @@ -410,47 +336,12 @@ public void PutIntegrationTest() Customer = Customer, Analyze = true }; - - try - { - konduto.Analyze(order); - Assert.True(order.Recommendation != KondutoRecommendation.none); - } - catch (KondutoException ex) - { - Assert.True(false, $"Konduto exception shouldn't happen here. {ex.Message}"); - } - - try - { - konduto.UpdateOrderStatus(id, KondutoOrderStatus.fraud, "Manual Review"); - } - catch (KondutoException ex) - { - Assert.True(false, "Konduto exception shouldn't happen here."); - } - - try - { - konduto.UpdateOrderStatus(id, KondutoOrderStatus.not_authorized, "Manual Review"); - } - catch (KondutoException ex) - { - Assert.True(false, "Konduto exception shouldn't happen here."); - } - catch (Exception e) - { - Assert.True(false, "Exception: " + e.ToString()); - } - - try - { - KondutoOrder updatedOrder = konduto.GetOrder(id); - } - catch (KondutoException ex) - { - Assert.True(false, $"Konduto exception shouldn't happen here. {ex.Message}"); - } + konduto.Analyze(order); + Assert.True(order.Recommendation != KondutoRecommendation.none); + konduto.UpdateOrderStatus(id, KondutoOrderStatus.fraud, "Manual Review"); + konduto.UpdateOrderStatus(id, KondutoOrderStatus.not_authorized, "Manual Review"); + var updatedOrder = konduto.GetOrder(id); + Assert.NotNull(updatedOrder); } [Fact] @@ -467,26 +358,10 @@ public void SendOrderToKondutoButDoNotAnalyzeTest() orderToSend.Analyze = false; Assert.False(orderToSend.Analyze, "order analyze should be false"); - - try - { - orderToSend = konduto.Analyze(orderToSend); // do analyze - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "order should be valid"); - } - catch (KondutoHTTPException e) - { - Assert.True(false, "server should respond with status 200"); - } - catch (KondutoUnexpectedAPIResponseException e) - { - Assert.True(false, "server should respond with status 200"); - } - - Assert.True(orderToSend.Score == null); - Assert.True(orderToSend.Recommendation == KondutoRecommendation.none); + + orderToSend = konduto.Analyze(orderToSend); + Assert.Null(orderToSend.Score); + Assert.Equal(KondutoRecommendation.none, orderToSend.Recommendation); } [Fact] @@ -500,24 +375,7 @@ public void AnalyzeInvalidOrderTest() konduto.__MessageHandler = fakeResponseHandler; KondutoOrder orderToSend = new KondutoOrder(); - - try - { - orderToSend = konduto.Analyze(orderToSend); // do analyze - Assert.True(false, "KondutoInvalidEntityException should have been thrown"); - } - catch (KondutoInvalidEntityException e) - { - //ok - } - catch (KondutoHTTPException e) - { - Assert.True(false, "Expected KondutoInvalidEntityException, but got KondutoHTTPException"); - } - catch (KondutoUnexpectedAPIResponseException e) - { - Assert.True(false, "Expected KondutoInvalidEntityException, but got KondutoHTTPException"); - } + Assert.Throws(() => konduto.Analyze(orderToSend)); } [Fact] @@ -525,27 +383,15 @@ public void AnalyzeHTTPErrorTest() { foreach (int code in HTTP_STATUSES) { - try - { - var fakeResponseHandler = new FakeResponseHandler(); + var fakeResponseHandler = new FakeResponseHandler(); - var message = new HttpResponseMessage((HttpStatusCode)code); - message.Content = new StringContent(ORDER_FROM_FILE.ToJson()); + var message = new HttpResponseMessage((HttpStatusCode)code); + message.Content = new StringContent(ORDER_FROM_FILE.ToJson()); - fakeResponseHandler.AddFakeResponse(konduto.KondutoPostOrderUrl(), message); - konduto.__MessageHandler = fakeResponseHandler; + fakeResponseHandler.AddFakeResponse(konduto.KondutoPostOrderUrl(), message); + konduto.__MessageHandler = fakeResponseHandler; - konduto.Analyze(KondutoOrderFactory.basicOrder()); - Assert.True(false, "Exception expected"); - } - catch (KondutoHTTPException e) - { - //Ok - } - catch (Exception e) - { - Assert.True(false, "KondutoHTTPException was expected"); - } + Assert.ThrowsAny(() => konduto.Analyze(KondutoOrderFactory.basicOrder())); } } @@ -558,19 +404,7 @@ public void UpdateSuccessfullyTest() fakeResponseHandler.AddFakeResponse(konduto.KondutoPutOrderUrl(ORDER_ID), message); konduto.__MessageHandler = fakeResponseHandler; - - try - { - konduto.UpdateOrderStatus(ORDER_ID, KondutoOrderStatus.approved, "no comments"); - } - catch (KondutoHTTPException e) - { - Assert.True(false, "order update should have succeeded"); - } - catch (KondutoUnexpectedAPIResponseException e) - { - Assert.True(false, "order update should have succeeded"); - } + konduto.UpdateOrderStatus(ORDER_ID, KondutoOrderStatus.approved, "no comments"); } [Fact] diff --git a/KdtTests/Models/KondutoAddressTest.cs b/KdtTests/Models/KondutoAddressTest.cs index 814ff2e..94b651d 100644 --- a/KdtTests/Models/KondutoAddressTest.cs +++ b/KdtTests/Models/KondutoAddressTest.cs @@ -14,20 +14,11 @@ public class KondutoAddressTest public void SerializeTest() { String expectedJSON = KondutoUtils.LoadJson(Resources.Load("address")).ToJson(); - String actualJSON = null; KondutoAddress address = KondutoAddressFactory.Create(); - try - { - actualJSON = address.ToJson(); - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "address should be valid"); - } - + var actualJSON = address.ToJson(); Assert.Equal(expectedJSON, actualJSON); - KondutoAddress addressFromJSON = KondutoModel.FromJson(expectedJSON); + var addressFromJSON = KondutoModel.FromJson(expectedJSON); Assert.Equal(address, addressFromJSON); } } diff --git a/KdtTests/Models/KondutoBoletoPaymentTest.cs b/KdtTests/Models/KondutoBoletoPaymentTest.cs index 3c0c627..c943cb0 100644 --- a/KdtTests/Models/KondutoBoletoPaymentTest.cs +++ b/KdtTests/Models/KondutoBoletoPaymentTest.cs @@ -14,20 +14,10 @@ public class KondutoBoletoPaymentTest public void SerializeTest() { String expectedJSON = KondutoUtils.GetFirstJArrayElement(Resources.Load("payments")); - String actualJSON = null; KondutoCreditCardPayment payment = KondutoPaymentFactory.CreateCreditCardPayment(); - try - { - actualJSON = payment.ToJson(); - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "address should be valid"); - } - + var actualJSON = payment.ToJson(); Assert.Equal(expectedJSON, actualJSON); - KondutoCreditCardPayment paymentFromJSON = KondutoModel.FromJson(expectedJSON); Assert.Equal(payment, paymentFromJSON); } diff --git a/KdtTests/Models/KondutoCustomerTest.cs b/KdtTests/Models/KondutoCustomerTest.cs index c00d6a8..0c49eb4 100644 --- a/KdtTests/Models/KondutoCustomerTest.cs +++ b/KdtTests/Models/KondutoCustomerTest.cs @@ -14,19 +14,10 @@ public class KondutoCustomerTest [Fact] public void SerializationTest() { - KondutoCustomer customer = KondutoCustomerFactory.CompleteCustomer(); - String customerJSON = KondutoUtils.LoadJson(Resources.Load("customer")).ToJson(); - - try - { - var v = customer.ToJson(); - Assert.Equal(customerJSON, customer.ToJson()); - } - catch (KondutoInvalidEntityException e) { - Debug.WriteLine(e.Message); - } - - KondutoCustomer deserializedCustomer = KondutoModel.FromJson(customerJSON); + var customer = KondutoCustomerFactory.CompleteCustomer(); + var customerJSON = KondutoUtils.LoadJson(Resources.Load("customer")).ToJson(); + Assert.Equal(customerJSON, customer.ToJson()); + var deserializedCustomer = KondutoModel.FromJson(customerJSON); Assert.Equal(customer, deserializedCustomer); } } diff --git a/KdtTests/Models/KondutoDeviceTest.cs b/KdtTests/Models/KondutoDeviceTest.cs index f59bc29..8d115b7 100644 --- a/KdtTests/Models/KondutoDeviceTest.cs +++ b/KdtTests/Models/KondutoDeviceTest.cs @@ -15,16 +15,7 @@ public void SerializeTest() { KondutoDevice device = KondutoDeviceFactory.Create(); String deviceJSON = KondutoUtils.LoadJson(Resources.Load("device")).ToJson(); - - try - { - Assert.Equal(deviceJSON, device.ToJson()); - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "device should be valid"); - } - + Assert.Equal(deviceJSON, device.ToJson()); Assert.Equal(KondutoModel.FromJson(deviceJSON), device); } } diff --git a/KdtTests/Models/KondutoGeolocationTest.cs b/KdtTests/Models/KondutoGeolocationTest.cs index f3664a3..4112b2f 100644 --- a/KdtTests/Models/KondutoGeolocationTest.cs +++ b/KdtTests/Models/KondutoGeolocationTest.cs @@ -17,16 +17,8 @@ public void SerializationTest() KondutoGeolocation geolocation = KondutoGeolocationFactory.Create(); String geolocationJSON = KondutoUtils.LoadJson(Resources.Load("geolocation")).ToJson(); - - try - { - Assert.Equal(geolocationJSON, geolocation.ToJson()); - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "geolocation should be valid"); - } + Assert.Equal(geolocationJSON, geolocation.ToJson()); KondutoGeolocation geolocationDeserialized = KondutoModel.FromJson(geolocationJSON); Assert.Equal(geolocation, geolocationDeserialized); } diff --git a/KdtTests/Models/KondutoItemTest.cs b/KdtTests/Models/KondutoItemTest.cs index b3d590f..ff2997e 100644 --- a/KdtTests/Models/KondutoItemTest.cs +++ b/KdtTests/Models/KondutoItemTest.cs @@ -16,15 +16,7 @@ public class KondutoItemTest [Fact] public void SerializationTest() { - try - { - var v = greenTShirt.ToJson(); - Assert.Equal(greenTShirtJSON, greenTShirt.ToJson()); - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "Green T-Shirt should be valid"); - } + Assert.Equal(greenTShirtJSON, greenTShirt.ToJson()); } [Fact] diff --git a/KdtTests/Models/KondutoNavigationInfoTest.cs b/KdtTests/Models/KondutoNavigationInfoTest.cs index bc9f285..4961688 100644 --- a/KdtTests/Models/KondutoNavigationInfoTest.cs +++ b/KdtTests/Models/KondutoNavigationInfoTest.cs @@ -16,17 +16,7 @@ public void SerializationTest() KondutoNavigationInfo navigationInfo = KondutoNavigationInfoFactory.Create(); String navigationInfoJSON = KondutoUtils.LoadJson(Resources.Load("navigation")).ToJson(); - - try - { - var c = navigationInfo.ToJson(); - Assert.Equal(navigationInfoJSON ,navigationInfo.ToJson()); - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "navigation info should be valid"); - } - + Assert.Equal(navigationInfoJSON ,navigationInfo.ToJson()); KondutoNavigationInfo navigationInfoDeserialized = KondutoModel.FromJson(navigationInfoJSON); Assert.Equal(navigationInfoDeserialized, navigationInfo); } diff --git a/KdtTests/Models/KondutoOrderTest.cs b/KdtTests/Models/KondutoOrderTest.cs index ae0efa4..cf3dbb3 100644 --- a/KdtTests/Models/KondutoOrderTest.cs +++ b/KdtTests/Models/KondutoOrderTest.cs @@ -32,16 +32,8 @@ public void SerializationTest() { KondutoOrder order = KondutoOrderFactory.completeOrder(); String orderJSON = KondutoUtils.LoadJson(Resources.Load("order")).ToJson(); - - try - { - Assert.Equal(orderJSON, order.ToJson()); - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "order should be valid"); - } - + + Assert.Equal(orderJSON, order.ToJson()); KondutoOrder deserializedOrder = KondutoModel.FromJson(orderJSON); Assert.True(order.Equals(deserializedOrder), "deserialization failed"); } @@ -51,21 +43,11 @@ public void SerializationTestWithShoppingAndFlight() { KondutoOrder order = KondutoOrderFactory.completeOrder(); order.Travel = KondutoFlightFactory.CreateFlight(); - - try - { - order.ToJson(); - Assert.True(false, "order should be invalid"); - } - catch (KondutoInvalidEntityException e) - { - //ok - } + Assert.Throws(() => order.ToJson()); order = KondutoOrderFactory.completeOrder(); order.Travel = KondutoFlightFactory.CreateFlight(); order.ShoppingCart = null; - //ok } [Fact] diff --git a/KdtTests/Models/KondutoPassengerTest.cs b/KdtTests/Models/KondutoPassengerTest.cs index cd2391b..dd08900 100644 --- a/KdtTests/Models/KondutoPassengerTest.cs +++ b/KdtTests/Models/KondutoPassengerTest.cs @@ -15,18 +15,9 @@ public class KondutoPassengerTest public void SerializationTest() { String expectedJSON = KondutoUtils.LoadJson(Resources.Load("passenger")).ToJson(); - String actualJSON = null; KondutoPassenger passenger = KondutoPassengerFactory.CompletePassenger(); - - try - { - actualJSON = passenger.ToJson(); - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "passenger should be valid"); - } - + + var actualJSON = passenger.ToJson(); Assert.Equal(expectedJSON, actualJSON); KondutoPassenger passengerFromJson = KondutoModel.FromJson(expectedJSON); Assert.Equal(passenger, passengerFromJson); diff --git a/KdtTests/Models/KondutoPaymentTest.cs b/KdtTests/Models/KondutoPaymentTest.cs index 90dffb6..0f43d0d 100644 --- a/KdtTests/Models/KondutoPaymentTest.cs +++ b/KdtTests/Models/KondutoPaymentTest.cs @@ -107,20 +107,10 @@ public void VoucherSerializeTest() { JArray a = JArray.Parse(Resources.Load("payments")); String expectedJSON = a[2].ToString(); - String actualJSON = null; KondutoVoucherPayment payment = KondutoPaymentFactory.CreateVoucherPayment(); - try - { - actualJSON = payment.ToJson(); - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "payment should be valid"); - } - + var actualJSON = payment.ToJson(); Assert.Equal(expectedJSON, actualJSON); - KondutoVoucherPayment paymentFromJSON = KondutoModel.FromJson(expectedJSON); Assert.Equal(payment, paymentFromJSON); } diff --git a/KdtTests/Models/KondutoSellerTest.cs b/KdtTests/Models/KondutoSellerTest.cs index 2c1684e..d8e0131 100644 --- a/KdtTests/Models/KondutoSellerTest.cs +++ b/KdtTests/Models/KondutoSellerTest.cs @@ -14,18 +14,9 @@ public class KondutoSellerTest public void SerializationTest() { String expectedJSON = KondutoUtils.LoadJson(Resources.Load("seller")).ToJson(); - String actualJSON = null; KondutoSeller seller = KondutoSellerFactory.Create(); - try - { - actualJSON = seller.ToJson(); - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "seller should be valid"); - } - + var actualJSON = seller.ToJson(); Assert.Equal(expectedJSON, actualJSON); KondutoSeller sellerFromJson = KondutoModel.FromJson(expectedJSON); Assert.Equal(seller, sellerFromJson); diff --git a/KdtTests/Models/KondutoTravelTest.cs b/KdtTests/Models/KondutoTravelTest.cs index d7e554f..6052f4c 100644 --- a/KdtTests/Models/KondutoTravelTest.cs +++ b/KdtTests/Models/KondutoTravelTest.cs @@ -14,18 +14,9 @@ public class KondutoTravelTest public void SerializeTest() { String expectedJSON = KondutoUtils.LoadJson(Resources.Load("flight")).ToJson(); - String actualJSON = null; KondutoTravel flight = KondutoFlightFactory.CreateFlight(); - try - { - actualJSON = flight.ToJson(); - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "flight should be valid"); - } - + var actualJSON = flight.ToJson(); Assert.Equal(expectedJSON, actualJSON); KondutoTravel flightFromJSON = KondutoModel.FromJson(expectedJSON); Assert.Equal(flight, flightFromJSON); From b7a2390661ce18e80332cf7978cf133c47ce4850 Mon Sep 17 00:00:00 2001 From: Victor Botamedi Date: Thu, 23 Mar 2017 17:41:22 -0300 Subject: [PATCH 07/21] Removing try catch blocks --- KdtTests/Models/KondutoPaymentTest.cs | 50 +++------------------------ 1 file changed, 5 insertions(+), 45 deletions(-) diff --git a/KdtTests/Models/KondutoPaymentTest.cs b/KdtTests/Models/KondutoPaymentTest.cs index 0f43d0d..f6c8837 100644 --- a/KdtTests/Models/KondutoPaymentTest.cs +++ b/KdtTests/Models/KondutoPaymentTest.cs @@ -15,20 +15,10 @@ public class KondutoPaymentTest public void CreditSerializeTest() { String expectedJSON = KondutoUtils.GetFirstJArrayElement(Resources.Load("payments")); - String actualJSON = null; KondutoCreditCardPayment payment = KondutoPaymentFactory.CreateCreditCardPayment(); - - try - { - actualJSON = payment.ToJson(); - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "address should be valid"); - } - + + var actualJSON = payment.ToJson(); Assert.Equal(expectedJSON, actualJSON); - KondutoCreditCardPayment paymentFromJSON = KondutoModel.FromJson(expectedJSON); Assert.Equal(payment, paymentFromJSON); } @@ -38,20 +28,10 @@ public void BoletoSerializeTest() { JArray a = JArray.Parse(Resources.Load("payments")); String expectedJSON = a.Last.ToString(); - String actualJSON = null; KondutoBoletoPayment payment = KondutoPaymentFactory.CreateBoletoPayment(); - try - { - actualJSON = payment.ToJson(); - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "payment should be valid"); - } - + var actualJSON = payment.ToJson(); Assert.Equal(expectedJSON, actualJSON); - KondutoBoletoPayment paymentFromJSON = KondutoModel.FromJson(expectedJSON); Assert.Equal(payment, paymentFromJSON); } @@ -61,20 +41,10 @@ public void DebitSerializeTest() { JArray a = JArray.Parse(Resources.Load("payments")); String expectedJSON = a[1].ToString(); - String actualJSON = null; KondutoDebitPayment payment = KondutoPaymentFactory.CreateDebitPayment(); - try - { - actualJSON = payment.ToJson(); - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "payment should be valid"); - } - + var actualJSON = payment.ToJson(); Assert.Equal(expectedJSON, actualJSON); - KondutoDebitPayment paymentFromJSON = KondutoModel.FromJson(expectedJSON); Assert.Equal(payment, paymentFromJSON); } @@ -84,20 +54,10 @@ public void TransferSerializeTest() { JArray a = JArray.Parse(Resources.Load("payments")); String expectedJSON = a[3].ToString(); - String actualJSON = null; KondutoTransferPayment payment = KondutoPaymentFactory.CreateTransferPayment(); - try - { - actualJSON = payment.ToJson(); - } - catch (KondutoInvalidEntityException e) - { - Assert.True(false, "payment should be valid"); - } - + var actualJSON = payment.ToJson(); Assert.Equal(expectedJSON, actualJSON); - KondutoTransferPayment paymentFromJSON = KondutoModel.FromJson(expectedJSON); Assert.Equal(payment, paymentFromJSON); } From 8b194c6958233a1b7498628f3afb2b5ad199fc46 Mon Sep 17 00:00:00 2001 From: Victor Botamedi Date: Thu, 23 Mar 2017 17:41:39 -0300 Subject: [PATCH 08/21] Changing package version --- KdtSdk/project.json | 2 +- KdtTests/project.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/KdtSdk/project.json b/KdtSdk/project.json index 125fcf1..f88722e 100644 --- a/KdtSdk/project.json +++ b/KdtSdk/project.json @@ -3,7 +3,7 @@ "description": "A sdk to interact with Konduto's api", "authors": ["Konduto"], "copyright": "Copyright © 2015", - "version": "1.0.1", + "version": "1.1.0", "dependencies": { "System.Net.Http": "4.3.1", diff --git a/KdtTests/project.json b/KdtTests/project.json index 5721229..b71ede2 100644 --- a/KdtTests/project.json +++ b/KdtTests/project.json @@ -2,11 +2,11 @@ "title": "KdtTests", "authors": ["Konduto"], "copyright": "Copyright © 2015", - "version": "1.0.1", + "version": "1.1.0", "testRunner": "xunit", "dependencies": { - "KdtSdk": "1.0.1", + "KdtSdk": "1.1.0", "xunit": "2.2.0-beta2-build3300", "dotnet-test-xunit": "2.2.0-preview2-build1029", "System.Diagnostics.TraceSource": "4.0.0-rc2-24027" From 86bebebd1829f4a23bf5ba8e6fc80f8ac1107874 Mon Sep 17 00:00:00 2001 From: Victor Botamedi Date: Thu, 23 Mar 2017 17:53:49 -0300 Subject: [PATCH 09/21] Making net45 compatible --- KdtSdk/Utils/KondutoUtils.cs | 4 ++++ KdtSdk/project.json | 4 +++- KdtTests/project.json | 2 -- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/KdtSdk/Utils/KondutoUtils.cs b/KdtSdk/Utils/KondutoUtils.cs index bc9b532..45e694b 100644 --- a/KdtSdk/Utils/KondutoUtils.cs +++ b/KdtSdk/Utils/KondutoUtils.cs @@ -83,7 +83,11 @@ public abstract class JsonCreationConverter : JsonConverter public override bool CanConvert(Type objectType) { + #if NETSTANDARD1_3 return typeof(T).GetTypeInfo().IsAssignableFrom(objectType.GetTypeInfo()); + #else + return typeof(T).IsAssignableFrom(objectType); + #endif } public override object ReadJson(JsonReader reader, diff --git a/KdtSdk/project.json b/KdtSdk/project.json index f88722e..15aaa91 100644 --- a/KdtSdk/project.json +++ b/KdtSdk/project.json @@ -10,8 +10,10 @@ "Newtonsoft.Json": "10.0.1" }, "frameworks": { - "netcoreapp1.0": { + "net45": {}, + "netstandard1.3": { "imports": [ + "portable-net45+win8", "netstandard1.6" ] } diff --git a/KdtTests/project.json b/KdtTests/project.json index b71ede2..7c8404f 100644 --- a/KdtTests/project.json +++ b/KdtTests/project.json @@ -21,8 +21,6 @@ "frameworks": { "netcoreapp1.0": { "imports": [ - "dotnet5.6", - "dnxcore50", "portable-net45+win8", "netstandard1.6" ], From 9fb52e66e85ded2be5bc65219475490955699b05 Mon Sep 17 00:00:00 2001 From: Victor Botamedi Date: Tue, 28 Mar 2017 13:46:57 -0300 Subject: [PATCH 10/21] Add .net core solution --- KdtSdk.sln | 24 ++++++++++++------------ KdtSdk/KdtSdk.xproj | 19 +++++++++++++++++++ KdtTests/KdtTests.xproj | 21 +++++++++++++++++++++ global.json | 6 ++++++ 4 files changed, 58 insertions(+), 12 deletions(-) create mode 100644 KdtSdk/KdtSdk.xproj create mode 100644 KdtTests/KdtTests.xproj create mode 100644 global.json diff --git a/KdtSdk.sln b/KdtSdk.sln index 3b11c3d..543c667 100644 --- a/KdtSdk.sln +++ b/KdtSdk.sln @@ -1,11 +1,11 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Express 2013 for Windows Desktop -VisualStudioVersion = 12.0.31101.0 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KdtSdk", "KdtSdk\KdtSdk.csproj", "{10BDEBE8-3AB2-4867-931E-2E352B1E2B72}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "KdtSdk", "KdtSdk\KdtSdk.xproj", "{7A60D91B-45A0-4DD4-A6EB-6064C6DDEB6B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KdtTests", "KdtTests\KdtTests.csproj", "{81FEFD51-58CA-404B-9DCC-0BC9024BC4EE}" +Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "KdtTests", "KdtTests\KdtTests.xproj", "{30579B8D-AE9E-483F-A7DA-66FCFFFDD9DA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -13,14 +13,14 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {10BDEBE8-3AB2-4867-931E-2E352B1E2B72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {10BDEBE8-3AB2-4867-931E-2E352B1E2B72}.Debug|Any CPU.Build.0 = Debug|Any CPU - {10BDEBE8-3AB2-4867-931E-2E352B1E2B72}.Release|Any CPU.ActiveCfg = Release|Any CPU - {10BDEBE8-3AB2-4867-931E-2E352B1E2B72}.Release|Any CPU.Build.0 = Release|Any CPU - {81FEFD51-58CA-404B-9DCC-0BC9024BC4EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {81FEFD51-58CA-404B-9DCC-0BC9024BC4EE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {81FEFD51-58CA-404B-9DCC-0BC9024BC4EE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {81FEFD51-58CA-404B-9DCC-0BC9024BC4EE}.Release|Any CPU.Build.0 = Release|Any CPU + {7A60D91B-45A0-4DD4-A6EB-6064C6DDEB6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7A60D91B-45A0-4DD4-A6EB-6064C6DDEB6B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7A60D91B-45A0-4DD4-A6EB-6064C6DDEB6B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7A60D91B-45A0-4DD4-A6EB-6064C6DDEB6B}.Release|Any CPU.Build.0 = Release|Any CPU + {30579B8D-AE9E-483F-A7DA-66FCFFFDD9DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {30579B8D-AE9E-483F-A7DA-66FCFFFDD9DA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {30579B8D-AE9E-483F-A7DA-66FCFFFDD9DA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {30579B8D-AE9E-483F-A7DA-66FCFFFDD9DA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/KdtSdk/KdtSdk.xproj b/KdtSdk/KdtSdk.xproj new file mode 100644 index 0000000..7d1db17 --- /dev/null +++ b/KdtSdk/KdtSdk.xproj @@ -0,0 +1,19 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 7a60d91b-45a0-4dd4-a6eb-6064c6ddeb6b + KdtSdk + .\obj + .\bin\ + + + + 2.0 + + + \ No newline at end of file diff --git a/KdtTests/KdtTests.xproj b/KdtTests/KdtTests.xproj new file mode 100644 index 0000000..adc64eb --- /dev/null +++ b/KdtTests/KdtTests.xproj @@ -0,0 +1,21 @@ + + + + 14.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + 30579b8d-ae9e-483f-a7da-66fcfffdd9da + KdtTests + .\obj + .\bin\ + + + 2.0 + + + + + + \ No newline at end of file diff --git a/global.json b/global.json new file mode 100644 index 0000000..1c57463 --- /dev/null +++ b/global.json @@ -0,0 +1,6 @@ +{ + "projects": ["KdtSdk", "KdtTests"], + "sdk": { + "version": "1.0.0-preview2-003121" + } +} From d3f63d6245786756c8078e429740fa8052fab4dc Mon Sep 17 00:00:00 2001 From: Victor Botamedi Date: Wed, 31 May 2017 14:46:46 -0300 Subject: [PATCH 11/21] Add AnalyzeAsync method --- KdtSdk/Konduto.cs | 59 +++++++++++++++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 20 deletions(-) diff --git a/KdtSdk/Konduto.cs b/KdtSdk/Konduto.cs index e29e6bd..95d5fce 100644 --- a/KdtSdk/Konduto.cs +++ b/KdtSdk/Konduto.cs @@ -7,6 +7,7 @@ using KdtSdk.Exceptions; using System.Net.Http.Headers; using Newtonsoft.Json.Linq; +using System.Threading.Tasks; namespace KdtSdk { @@ -172,7 +173,7 @@ private HttpClient CreateHttpClient() /// public KondutoOrder GetOrder(String orderId) { - HttpClient client = CreateHttpClient(); + var client = CreateHttpClient(); this.requestBody = orderId; @@ -211,37 +212,55 @@ public KondutoOrder GetOrder(String orderId) /// /// /// - public KondutoOrder Analyze(KondutoOrder order) + public async Task AnalyzeAsync(KondutoOrder order) { - HttpClient httpClient = CreateHttpClient(); - - var response = httpClient.PostAsync(KondutoPostOrderUrl(), + var httpClient = CreateHttpClient(); + var response = await httpClient.PostAsync(KondutoPostOrderUrl(), new StringContent(order.ToJson(), Encoding.UTF8, "application/json")); - this.requestBody = order.ToJson(); - - if (response.Result.IsSuccessStatusCode) + requestBody = order.ToJson(); + if (response.IsSuccessStatusCode) { - // by calling. Result you are performing a synchronous call - var responseContent = response.Result.Content; - - // by calling. Result you are synchronously reading the result - String responseString = responseContent.ReadAsStringAsync().Result; - - this.responseBody = responseString; + var responseContent = response.Content; + var responseString = await responseContent.ReadAsStringAsync(); + responseBody = responseString; if (order.Analyze) - order.MergeKondutoOrderResponse(KondutoAPIFullResponse.FromJson(responseString).Order); - + order.MergeKondutoOrderResponse( + KondutoAPIFullResponse.FromJson(responseString).Order + ); return order; } else { - var responseContentError = response.Result.Content != null ? response.Result.Content.ReadAsStringAsync().Result : "Error with response"; - throw KondutoHTTPExceptionFactory.buildException((int)response.Result.StatusCode, - responseContentError); + var responseContentError = response.Content != null ? + await response.Content.ReadAsStringAsync() : + "Error with response"; + throw KondutoHTTPExceptionFactory.buildException( + (int)response.StatusCode, responseContentError); + } + } + + /// + /// Sends an order for Konduto and gets it analyzed + /// (i.e with recommendation, score, device, geolocation and navigation info). + /// @see Konduto API Spec + /// + /// a {@link KondutoOrder} instance + /// + /// + /// + public KondutoOrder Analyze(KondutoOrder order) + { + try + { + return AnalyzeAsync(order).Result; + } + catch (AggregateException ae) + { + throw ae.InnerException; } } From c6fea842545a54e4bfa89505f649fd32bd23b12c Mon Sep 17 00:00:00 2001 From: Victor Botamedi Date: Wed, 31 May 2017 14:50:37 -0300 Subject: [PATCH 12/21] Add GetOrderAsync method --- KdtSdk/Konduto.cs | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/KdtSdk/Konduto.cs b/KdtSdk/Konduto.cs index 95d5fce..555163b 100644 --- a/KdtSdk/Konduto.cs +++ b/KdtSdk/Konduto.cs @@ -171,35 +171,52 @@ private HttpClient CreateHttpClient() /// a {@link KondutoOrder} instance /// /// - public KondutoOrder GetOrder(String orderId) + public async Task GetOrderAsync(String orderId) { var client = CreateHttpClient(); + requestBody = orderId; - this.requestBody = orderId; - - var response = client.GetAsync(KondutoGetOrderSuffix(orderId)).Result; + var response = await client.GetAsync(KondutoGetOrderSuffix(orderId)); if (response.IsSuccessStatusCode) { var responseContent = response.Content; - String responseString = responseContent.ReadAsStringAsync().Result; - this.responseBody = responseString; - - JObject getResponse = JsonConvert.DeserializeObject(responseString); + var responseString = await responseContent.ReadAsStringAsync(); + responseBody = responseString; + var getResponse = JsonConvert.DeserializeObject(responseString); KondutoOrder order = null; - JToken jt; if (getResponse.TryGetValue("order", out jt)) { order = KondutoModel.FromJson(jt.ToString()); } - return order; } - else + throw KondutoHTTPExceptionFactory.buildException( + (int)response.StatusCode, + await response.Content.ReadAsStringAsync() + ); + } + + /// + /// Queries an order from Konduto's API. + /// Syncronous + /// @see Konduto API Spec + /// + /// the order identifier + /// a {@link KondutoOrder} instance + /// + /// + public KondutoOrder GetOrder(String orderId) + { + try + { + return GetOrderAsync(orderId).Result; + } + catch (AggregateException ae) { - throw KondutoHTTPExceptionFactory.buildException((int)response.StatusCode, response.Content.ReadAsStringAsync().Result); + throw ae.InnerException; } } From d8e088565fee37a8fe72e47f994020ae816a42db Mon Sep 17 00:00:00 2001 From: Victor Botamedi Date: Wed, 31 May 2017 15:04:08 -0300 Subject: [PATCH 13/21] Add UpdateOrderStatusAsync --- KdtSdk/Konduto.cs | 53 ++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/KdtSdk/Konduto.cs b/KdtSdk/Konduto.cs index 555163b..5b71ebd 100644 --- a/KdtSdk/Konduto.cs +++ b/KdtSdk/Konduto.cs @@ -298,7 +298,7 @@ private class KondutoAPIFullResponse : KondutoModel /// some comments (an empty String is accepted, although we recommend setting it to at least a timestamp) /// /// - public void UpdateOrderStatus(String orderId, KondutoOrderStatus newStatus, String comments) + public async Task UpdateOrderStatusAsync(string orderId, KondutoOrderStatus newStatus, string comments) { HashSet allowed = new HashSet { @@ -310,36 +310,28 @@ public void UpdateOrderStatus(String orderId, KondutoOrderStatus newStatus, Stri }; if (!allowed.Contains(newStatus)) { throw new ArgumentException("Illegal status: " + newStatus); } - if (comments == null) { throw new NullReferenceException("Comments cannot be null."); } JObject requestBody = new JObject(); requestBody.Add("status", newStatus.ToString().ToLower()); requestBody.Add("comments", comments); - HttpClient client = CreateHttpClient(); - - var response = client.PutAsync(KondutoPutOrderUrl(orderId), - new StringContent( - requestBody.ToString(), - Encoding.UTF8, - "application/json")); + var client = CreateHttpClient(); + var response = await client.PutAsync(KondutoPutOrderUrl(orderId), + new StringContent(requestBody.ToString(), Encoding.UTF8, "application/json")); - if (response.Result.IsSuccessStatusCode) + if (response.IsSuccessStatusCode) { - JObject responseBody = JsonConvert.DeserializeObject( - response.Result.Content.ReadAsStringAsync().Result); + var responseBody = JsonConvert.DeserializeObject( + await response.Content.ReadAsStringAsync()); this.responseBody = responseBody.ToString(); JToken orderUpdateResponse; - if (responseBody.TryGetValue("order", out orderUpdateResponse)) { - JObject updatedOrder = JsonConvert.DeserializeObject(orderUpdateResponse.ToString()); - + var updatedOrder = JsonConvert.DeserializeObject(orderUpdateResponse.ToString()); JToken statusResponse; - if (!updatedOrder.TryGetValue("old_status", out statusResponse) || !updatedOrder.TryGetValue("new_status", out statusResponse)) { @@ -348,12 +340,35 @@ public void UpdateOrderStatus(String orderId, KondutoOrderStatus newStatus, Stri } } else - { - throw KondutoHTTPExceptionFactory.buildException((int)response.Result.StatusCode, - response.Result.Content.ReadAsStringAsync().Result); + { + throw KondutoHTTPExceptionFactory.buildException( + (int)response.StatusCode, + await response.Content.ReadAsStringAsync()); } } + /// + /// Updates an order status. + /// @see Konduto API Spec + /// + /// the order to update + /// the new status (APPROVED, DECLINED or FRAUD) + /// some comments (an empty String is accepted, although we recommend setting it to at least a timestamp) + /// + /// + public void UpdateOrderStatus(string orderId, KondutoOrderStatus newStatus, string comments) + { + try + { + UpdateOrderStatusAsync(orderId, newStatus, comments).Wait(); + } + catch (AggregateException ae) + { + throw ae.InnerException; + } + + } + /// /// Base64 Encode /// From 1d19cf2a6856dca798aa55478b7b1f1ae501305b Mon Sep 17 00:00:00 2001 From: Daniel Wendhausen Date: Tue, 13 Jun 2017 09:31:16 -0300 Subject: [PATCH 14/21] Change System.Net.Http version --- KdtSdk/project.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/KdtSdk/project.json b/KdtSdk/project.json index 15aaa91..1d0ff61 100644 --- a/KdtSdk/project.json +++ b/KdtSdk/project.json @@ -4,9 +4,9 @@ "authors": ["Konduto"], "copyright": "Copyright © 2015", "version": "1.1.0", - + "dependencies": { - "System.Net.Http": "4.3.1", + "System.Net.Http": "4.1.0", "Newtonsoft.Json": "10.0.1" }, "frameworks": { From f2fbd5bb69fc79ae72a7274e6fd0667359d86ed5 Mon Sep 17 00:00:00 2001 From: Daniel Wendhausen Date: Fri, 16 Jun 2017 10:39:36 -0300 Subject: [PATCH 15/21] Move project files to a src folder --- KdtSdk.sln => src/KdtSdk.sln | 0 {KdtSdk => src/KdtSdk}/Exceptions/KondutoException.cs | 0 {KdtSdk => src/KdtSdk}/Exceptions/KondutoHTTPException.cs | 0 {KdtSdk => src/KdtSdk}/Exceptions/KondutoHTTPExceptionFactory.cs | 0 .../KdtSdk}/Exceptions/KondutoInvalidEntityException.cs | 0 .../KdtSdk}/Exceptions/KondutoUnexpectedAPIRespondeException.cs | 0 {KdtSdk => src/KdtSdk}/KdtSdk.xproj | 0 {KdtSdk => src/KdtSdk}/Konduto.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoAddress.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoBoletoPayment.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoCreditCardPayment.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoCreditCardPaymentStatus.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoCustomer.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoDebitPayment.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoDevice.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoGeolocation.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoItem.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoLoyaltyProgram.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoModel.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoNavigationInfo.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoOrder.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoOrderResponse.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoOrderStatus.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoPassenger.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoPayment.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoPaymentType.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoRecommendation.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoSeller.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoTransferPayment.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoTravel.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoTravelInformation.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoTravelType.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoVoucherPayment.cs | 0 {KdtSdk => src/KdtSdk}/Utils/KondutoUtils.cs | 0 {KdtSdk => src/KdtSdk}/app.config | 0 {KdtSdk => src/KdtSdk}/project.json | 0 .../KdtTests}/Exceptions/KondutoHTTPExceptionFactoryTest.cs | 0 {KdtTests => src/KdtTests}/Exceptions/KondutoHTTPExceptionTest.cs | 0 .../KdtTests}/Exceptions/KondutoInvalidEntityExceptionTest.cs | 0 .../KdtTests}/Exceptions/KondutoUnexpectedAPIResponseTest.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoAddressFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoCustomerFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoDeviceFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoFlightFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoGeolocationFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoItemFactory.cs | 0 .../KdtTests}/Factories/KondutoNavigationInfoFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoOrderFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoPassengerFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoPaymentFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoSellerFactory.cs | 0 {KdtTests => src/KdtTests}/KdtTests.xproj | 0 {KdtTests => src/KdtTests}/KondutoTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoAddressTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoBoletoPaymentTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoCustomerTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoDeviceTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoGeolocationTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoItemTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoNavigationInfoTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoOrderTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoPassengerTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoPaymentTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoSellerTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoTravelTest.cs | 0 {KdtTests => src/KdtTests}/Properties/Resources.cs | 0 {KdtTests => src/KdtTests}/Resources/address.txt | 0 {KdtTests => src/KdtTests}/Resources/customer.txt | 0 {KdtTests => src/KdtTests}/Resources/device.txt | 0 {KdtTests => src/KdtTests}/Resources/flight.txt | 0 {KdtTests => src/KdtTests}/Resources/geolocation.txt | 0 {KdtTests => src/KdtTests}/Resources/konduto_order.txt | 0 {KdtTests => src/KdtTests}/Resources/navigation.txt | 0 {KdtTests => src/KdtTests}/Resources/order.txt | 0 {KdtTests => src/KdtTests}/Resources/order_not_analyzed.txt | 0 {KdtTests => src/KdtTests}/Resources/passenger.txt | 0 {KdtTests => src/KdtTests}/Resources/payments.txt | 0 {KdtTests => src/KdtTests}/Resources/seller.txt | 0 {KdtTests => src/KdtTests}/Resources/shopping_cart.txt | 0 {KdtTests => src/KdtTests}/app.config | 0 {KdtTests => src/KdtTests}/packages.config | 0 {KdtTests => src/KdtTests}/project.json | 0 82 files changed, 0 insertions(+), 0 deletions(-) rename KdtSdk.sln => src/KdtSdk.sln (100%) rename {KdtSdk => src/KdtSdk}/Exceptions/KondutoException.cs (100%) rename {KdtSdk => src/KdtSdk}/Exceptions/KondutoHTTPException.cs (100%) rename {KdtSdk => src/KdtSdk}/Exceptions/KondutoHTTPExceptionFactory.cs (100%) rename {KdtSdk => src/KdtSdk}/Exceptions/KondutoInvalidEntityException.cs (100%) rename {KdtSdk => src/KdtSdk}/Exceptions/KondutoUnexpectedAPIRespondeException.cs (100%) rename {KdtSdk => src/KdtSdk}/KdtSdk.xproj (100%) rename {KdtSdk => src/KdtSdk}/Konduto.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoAddress.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoBoletoPayment.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoCreditCardPayment.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoCreditCardPaymentStatus.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoCustomer.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoDebitPayment.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoDevice.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoGeolocation.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoItem.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoLoyaltyProgram.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoModel.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoNavigationInfo.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoOrder.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoOrderResponse.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoOrderStatus.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoPassenger.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoPayment.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoPaymentType.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoRecommendation.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoSeller.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoTransferPayment.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoTravel.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoTravelInformation.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoTravelType.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoVoucherPayment.cs (100%) rename {KdtSdk => src/KdtSdk}/Utils/KondutoUtils.cs (100%) rename {KdtSdk => src/KdtSdk}/app.config (100%) rename {KdtSdk => src/KdtSdk}/project.json (100%) rename {KdtTests => src/KdtTests}/Exceptions/KondutoHTTPExceptionFactoryTest.cs (100%) rename {KdtTests => src/KdtTests}/Exceptions/KondutoHTTPExceptionTest.cs (100%) rename {KdtTests => src/KdtTests}/Exceptions/KondutoInvalidEntityExceptionTest.cs (100%) rename {KdtTests => src/KdtTests}/Exceptions/KondutoUnexpectedAPIResponseTest.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoAddressFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoCustomerFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoDeviceFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoFlightFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoGeolocationFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoItemFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoNavigationInfoFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoOrderFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoPassengerFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoPaymentFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoSellerFactory.cs (100%) rename {KdtTests => src/KdtTests}/KdtTests.xproj (100%) rename {KdtTests => src/KdtTests}/KondutoTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoAddressTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoBoletoPaymentTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoCustomerTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoDeviceTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoGeolocationTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoItemTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoNavigationInfoTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoOrderTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoPassengerTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoPaymentTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoSellerTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoTravelTest.cs (100%) rename {KdtTests => src/KdtTests}/Properties/Resources.cs (100%) rename {KdtTests => src/KdtTests}/Resources/address.txt (100%) rename {KdtTests => src/KdtTests}/Resources/customer.txt (100%) rename {KdtTests => src/KdtTests}/Resources/device.txt (100%) rename {KdtTests => src/KdtTests}/Resources/flight.txt (100%) rename {KdtTests => src/KdtTests}/Resources/geolocation.txt (100%) rename {KdtTests => src/KdtTests}/Resources/konduto_order.txt (100%) rename {KdtTests => src/KdtTests}/Resources/navigation.txt (100%) rename {KdtTests => src/KdtTests}/Resources/order.txt (100%) rename {KdtTests => src/KdtTests}/Resources/order_not_analyzed.txt (100%) rename {KdtTests => src/KdtTests}/Resources/passenger.txt (100%) rename {KdtTests => src/KdtTests}/Resources/payments.txt (100%) rename {KdtTests => src/KdtTests}/Resources/seller.txt (100%) rename {KdtTests => src/KdtTests}/Resources/shopping_cart.txt (100%) rename {KdtTests => src/KdtTests}/app.config (100%) rename {KdtTests => src/KdtTests}/packages.config (100%) rename {KdtTests => src/KdtTests}/project.json (100%) diff --git a/KdtSdk.sln b/src/KdtSdk.sln similarity index 100% rename from KdtSdk.sln rename to src/KdtSdk.sln diff --git a/KdtSdk/Exceptions/KondutoException.cs b/src/KdtSdk/Exceptions/KondutoException.cs similarity index 100% rename from KdtSdk/Exceptions/KondutoException.cs rename to src/KdtSdk/Exceptions/KondutoException.cs diff --git a/KdtSdk/Exceptions/KondutoHTTPException.cs b/src/KdtSdk/Exceptions/KondutoHTTPException.cs similarity index 100% rename from KdtSdk/Exceptions/KondutoHTTPException.cs rename to src/KdtSdk/Exceptions/KondutoHTTPException.cs diff --git a/KdtSdk/Exceptions/KondutoHTTPExceptionFactory.cs b/src/KdtSdk/Exceptions/KondutoHTTPExceptionFactory.cs similarity index 100% rename from KdtSdk/Exceptions/KondutoHTTPExceptionFactory.cs rename to src/KdtSdk/Exceptions/KondutoHTTPExceptionFactory.cs diff --git a/KdtSdk/Exceptions/KondutoInvalidEntityException.cs b/src/KdtSdk/Exceptions/KondutoInvalidEntityException.cs similarity index 100% rename from KdtSdk/Exceptions/KondutoInvalidEntityException.cs rename to src/KdtSdk/Exceptions/KondutoInvalidEntityException.cs diff --git a/KdtSdk/Exceptions/KondutoUnexpectedAPIRespondeException.cs b/src/KdtSdk/Exceptions/KondutoUnexpectedAPIRespondeException.cs similarity index 100% rename from KdtSdk/Exceptions/KondutoUnexpectedAPIRespondeException.cs rename to src/KdtSdk/Exceptions/KondutoUnexpectedAPIRespondeException.cs diff --git a/KdtSdk/KdtSdk.xproj b/src/KdtSdk/KdtSdk.xproj similarity index 100% rename from KdtSdk/KdtSdk.xproj rename to src/KdtSdk/KdtSdk.xproj diff --git a/KdtSdk/Konduto.cs b/src/KdtSdk/Konduto.cs similarity index 100% rename from KdtSdk/Konduto.cs rename to src/KdtSdk/Konduto.cs diff --git a/KdtSdk/Models/KondutoAddress.cs b/src/KdtSdk/Models/KondutoAddress.cs similarity index 100% rename from KdtSdk/Models/KondutoAddress.cs rename to src/KdtSdk/Models/KondutoAddress.cs diff --git a/KdtSdk/Models/KondutoBoletoPayment.cs b/src/KdtSdk/Models/KondutoBoletoPayment.cs similarity index 100% rename from KdtSdk/Models/KondutoBoletoPayment.cs rename to src/KdtSdk/Models/KondutoBoletoPayment.cs diff --git a/KdtSdk/Models/KondutoCreditCardPayment.cs b/src/KdtSdk/Models/KondutoCreditCardPayment.cs similarity index 100% rename from KdtSdk/Models/KondutoCreditCardPayment.cs rename to src/KdtSdk/Models/KondutoCreditCardPayment.cs diff --git a/KdtSdk/Models/KondutoCreditCardPaymentStatus.cs b/src/KdtSdk/Models/KondutoCreditCardPaymentStatus.cs similarity index 100% rename from KdtSdk/Models/KondutoCreditCardPaymentStatus.cs rename to src/KdtSdk/Models/KondutoCreditCardPaymentStatus.cs diff --git a/KdtSdk/Models/KondutoCustomer.cs b/src/KdtSdk/Models/KondutoCustomer.cs similarity index 100% rename from KdtSdk/Models/KondutoCustomer.cs rename to src/KdtSdk/Models/KondutoCustomer.cs diff --git a/KdtSdk/Models/KondutoDebitPayment.cs b/src/KdtSdk/Models/KondutoDebitPayment.cs similarity index 100% rename from KdtSdk/Models/KondutoDebitPayment.cs rename to src/KdtSdk/Models/KondutoDebitPayment.cs diff --git a/KdtSdk/Models/KondutoDevice.cs b/src/KdtSdk/Models/KondutoDevice.cs similarity index 100% rename from KdtSdk/Models/KondutoDevice.cs rename to src/KdtSdk/Models/KondutoDevice.cs diff --git a/KdtSdk/Models/KondutoGeolocation.cs b/src/KdtSdk/Models/KondutoGeolocation.cs similarity index 100% rename from KdtSdk/Models/KondutoGeolocation.cs rename to src/KdtSdk/Models/KondutoGeolocation.cs diff --git a/KdtSdk/Models/KondutoItem.cs b/src/KdtSdk/Models/KondutoItem.cs similarity index 100% rename from KdtSdk/Models/KondutoItem.cs rename to src/KdtSdk/Models/KondutoItem.cs diff --git a/KdtSdk/Models/KondutoLoyaltyProgram.cs b/src/KdtSdk/Models/KondutoLoyaltyProgram.cs similarity index 100% rename from KdtSdk/Models/KondutoLoyaltyProgram.cs rename to src/KdtSdk/Models/KondutoLoyaltyProgram.cs diff --git a/KdtSdk/Models/KondutoModel.cs b/src/KdtSdk/Models/KondutoModel.cs similarity index 100% rename from KdtSdk/Models/KondutoModel.cs rename to src/KdtSdk/Models/KondutoModel.cs diff --git a/KdtSdk/Models/KondutoNavigationInfo.cs b/src/KdtSdk/Models/KondutoNavigationInfo.cs similarity index 100% rename from KdtSdk/Models/KondutoNavigationInfo.cs rename to src/KdtSdk/Models/KondutoNavigationInfo.cs diff --git a/KdtSdk/Models/KondutoOrder.cs b/src/KdtSdk/Models/KondutoOrder.cs similarity index 100% rename from KdtSdk/Models/KondutoOrder.cs rename to src/KdtSdk/Models/KondutoOrder.cs diff --git a/KdtSdk/Models/KondutoOrderResponse.cs b/src/KdtSdk/Models/KondutoOrderResponse.cs similarity index 100% rename from KdtSdk/Models/KondutoOrderResponse.cs rename to src/KdtSdk/Models/KondutoOrderResponse.cs diff --git a/KdtSdk/Models/KondutoOrderStatus.cs b/src/KdtSdk/Models/KondutoOrderStatus.cs similarity index 100% rename from KdtSdk/Models/KondutoOrderStatus.cs rename to src/KdtSdk/Models/KondutoOrderStatus.cs diff --git a/KdtSdk/Models/KondutoPassenger.cs b/src/KdtSdk/Models/KondutoPassenger.cs similarity index 100% rename from KdtSdk/Models/KondutoPassenger.cs rename to src/KdtSdk/Models/KondutoPassenger.cs diff --git a/KdtSdk/Models/KondutoPayment.cs b/src/KdtSdk/Models/KondutoPayment.cs similarity index 100% rename from KdtSdk/Models/KondutoPayment.cs rename to src/KdtSdk/Models/KondutoPayment.cs diff --git a/KdtSdk/Models/KondutoPaymentType.cs b/src/KdtSdk/Models/KondutoPaymentType.cs similarity index 100% rename from KdtSdk/Models/KondutoPaymentType.cs rename to src/KdtSdk/Models/KondutoPaymentType.cs diff --git a/KdtSdk/Models/KondutoRecommendation.cs b/src/KdtSdk/Models/KondutoRecommendation.cs similarity index 100% rename from KdtSdk/Models/KondutoRecommendation.cs rename to src/KdtSdk/Models/KondutoRecommendation.cs diff --git a/KdtSdk/Models/KondutoSeller.cs b/src/KdtSdk/Models/KondutoSeller.cs similarity index 100% rename from KdtSdk/Models/KondutoSeller.cs rename to src/KdtSdk/Models/KondutoSeller.cs diff --git a/KdtSdk/Models/KondutoTransferPayment.cs b/src/KdtSdk/Models/KondutoTransferPayment.cs similarity index 100% rename from KdtSdk/Models/KondutoTransferPayment.cs rename to src/KdtSdk/Models/KondutoTransferPayment.cs diff --git a/KdtSdk/Models/KondutoTravel.cs b/src/KdtSdk/Models/KondutoTravel.cs similarity index 100% rename from KdtSdk/Models/KondutoTravel.cs rename to src/KdtSdk/Models/KondutoTravel.cs diff --git a/KdtSdk/Models/KondutoTravelInformation.cs b/src/KdtSdk/Models/KondutoTravelInformation.cs similarity index 100% rename from KdtSdk/Models/KondutoTravelInformation.cs rename to src/KdtSdk/Models/KondutoTravelInformation.cs diff --git a/KdtSdk/Models/KondutoTravelType.cs b/src/KdtSdk/Models/KondutoTravelType.cs similarity index 100% rename from KdtSdk/Models/KondutoTravelType.cs rename to src/KdtSdk/Models/KondutoTravelType.cs diff --git a/KdtSdk/Models/KondutoVoucherPayment.cs b/src/KdtSdk/Models/KondutoVoucherPayment.cs similarity index 100% rename from KdtSdk/Models/KondutoVoucherPayment.cs rename to src/KdtSdk/Models/KondutoVoucherPayment.cs diff --git a/KdtSdk/Utils/KondutoUtils.cs b/src/KdtSdk/Utils/KondutoUtils.cs similarity index 100% rename from KdtSdk/Utils/KondutoUtils.cs rename to src/KdtSdk/Utils/KondutoUtils.cs diff --git a/KdtSdk/app.config b/src/KdtSdk/app.config similarity index 100% rename from KdtSdk/app.config rename to src/KdtSdk/app.config diff --git a/KdtSdk/project.json b/src/KdtSdk/project.json similarity index 100% rename from KdtSdk/project.json rename to src/KdtSdk/project.json diff --git a/KdtTests/Exceptions/KondutoHTTPExceptionFactoryTest.cs b/src/KdtTests/Exceptions/KondutoHTTPExceptionFactoryTest.cs similarity index 100% rename from KdtTests/Exceptions/KondutoHTTPExceptionFactoryTest.cs rename to src/KdtTests/Exceptions/KondutoHTTPExceptionFactoryTest.cs diff --git a/KdtTests/Exceptions/KondutoHTTPExceptionTest.cs b/src/KdtTests/Exceptions/KondutoHTTPExceptionTest.cs similarity index 100% rename from KdtTests/Exceptions/KondutoHTTPExceptionTest.cs rename to src/KdtTests/Exceptions/KondutoHTTPExceptionTest.cs diff --git a/KdtTests/Exceptions/KondutoInvalidEntityExceptionTest.cs b/src/KdtTests/Exceptions/KondutoInvalidEntityExceptionTest.cs similarity index 100% rename from KdtTests/Exceptions/KondutoInvalidEntityExceptionTest.cs rename to src/KdtTests/Exceptions/KondutoInvalidEntityExceptionTest.cs diff --git a/KdtTests/Exceptions/KondutoUnexpectedAPIResponseTest.cs b/src/KdtTests/Exceptions/KondutoUnexpectedAPIResponseTest.cs similarity index 100% rename from KdtTests/Exceptions/KondutoUnexpectedAPIResponseTest.cs rename to src/KdtTests/Exceptions/KondutoUnexpectedAPIResponseTest.cs diff --git a/KdtTests/Factories/KondutoAddressFactory.cs b/src/KdtTests/Factories/KondutoAddressFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoAddressFactory.cs rename to src/KdtTests/Factories/KondutoAddressFactory.cs diff --git a/KdtTests/Factories/KondutoCustomerFactory.cs b/src/KdtTests/Factories/KondutoCustomerFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoCustomerFactory.cs rename to src/KdtTests/Factories/KondutoCustomerFactory.cs diff --git a/KdtTests/Factories/KondutoDeviceFactory.cs b/src/KdtTests/Factories/KondutoDeviceFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoDeviceFactory.cs rename to src/KdtTests/Factories/KondutoDeviceFactory.cs diff --git a/KdtTests/Factories/KondutoFlightFactory.cs b/src/KdtTests/Factories/KondutoFlightFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoFlightFactory.cs rename to src/KdtTests/Factories/KondutoFlightFactory.cs diff --git a/KdtTests/Factories/KondutoGeolocationFactory.cs b/src/KdtTests/Factories/KondutoGeolocationFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoGeolocationFactory.cs rename to src/KdtTests/Factories/KondutoGeolocationFactory.cs diff --git a/KdtTests/Factories/KondutoItemFactory.cs b/src/KdtTests/Factories/KondutoItemFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoItemFactory.cs rename to src/KdtTests/Factories/KondutoItemFactory.cs diff --git a/KdtTests/Factories/KondutoNavigationInfoFactory.cs b/src/KdtTests/Factories/KondutoNavigationInfoFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoNavigationInfoFactory.cs rename to src/KdtTests/Factories/KondutoNavigationInfoFactory.cs diff --git a/KdtTests/Factories/KondutoOrderFactory.cs b/src/KdtTests/Factories/KondutoOrderFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoOrderFactory.cs rename to src/KdtTests/Factories/KondutoOrderFactory.cs diff --git a/KdtTests/Factories/KondutoPassengerFactory.cs b/src/KdtTests/Factories/KondutoPassengerFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoPassengerFactory.cs rename to src/KdtTests/Factories/KondutoPassengerFactory.cs diff --git a/KdtTests/Factories/KondutoPaymentFactory.cs b/src/KdtTests/Factories/KondutoPaymentFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoPaymentFactory.cs rename to src/KdtTests/Factories/KondutoPaymentFactory.cs diff --git a/KdtTests/Factories/KondutoSellerFactory.cs b/src/KdtTests/Factories/KondutoSellerFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoSellerFactory.cs rename to src/KdtTests/Factories/KondutoSellerFactory.cs diff --git a/KdtTests/KdtTests.xproj b/src/KdtTests/KdtTests.xproj similarity index 100% rename from KdtTests/KdtTests.xproj rename to src/KdtTests/KdtTests.xproj diff --git a/KdtTests/KondutoTest.cs b/src/KdtTests/KondutoTest.cs similarity index 100% rename from KdtTests/KondutoTest.cs rename to src/KdtTests/KondutoTest.cs diff --git a/KdtTests/Models/KondutoAddressTest.cs b/src/KdtTests/Models/KondutoAddressTest.cs similarity index 100% rename from KdtTests/Models/KondutoAddressTest.cs rename to src/KdtTests/Models/KondutoAddressTest.cs diff --git a/KdtTests/Models/KondutoBoletoPaymentTest.cs b/src/KdtTests/Models/KondutoBoletoPaymentTest.cs similarity index 100% rename from KdtTests/Models/KondutoBoletoPaymentTest.cs rename to src/KdtTests/Models/KondutoBoletoPaymentTest.cs diff --git a/KdtTests/Models/KondutoCustomerTest.cs b/src/KdtTests/Models/KondutoCustomerTest.cs similarity index 100% rename from KdtTests/Models/KondutoCustomerTest.cs rename to src/KdtTests/Models/KondutoCustomerTest.cs diff --git a/KdtTests/Models/KondutoDeviceTest.cs b/src/KdtTests/Models/KondutoDeviceTest.cs similarity index 100% rename from KdtTests/Models/KondutoDeviceTest.cs rename to src/KdtTests/Models/KondutoDeviceTest.cs diff --git a/KdtTests/Models/KondutoGeolocationTest.cs b/src/KdtTests/Models/KondutoGeolocationTest.cs similarity index 100% rename from KdtTests/Models/KondutoGeolocationTest.cs rename to src/KdtTests/Models/KondutoGeolocationTest.cs diff --git a/KdtTests/Models/KondutoItemTest.cs b/src/KdtTests/Models/KondutoItemTest.cs similarity index 100% rename from KdtTests/Models/KondutoItemTest.cs rename to src/KdtTests/Models/KondutoItemTest.cs diff --git a/KdtTests/Models/KondutoNavigationInfoTest.cs b/src/KdtTests/Models/KondutoNavigationInfoTest.cs similarity index 100% rename from KdtTests/Models/KondutoNavigationInfoTest.cs rename to src/KdtTests/Models/KondutoNavigationInfoTest.cs diff --git a/KdtTests/Models/KondutoOrderTest.cs b/src/KdtTests/Models/KondutoOrderTest.cs similarity index 100% rename from KdtTests/Models/KondutoOrderTest.cs rename to src/KdtTests/Models/KondutoOrderTest.cs diff --git a/KdtTests/Models/KondutoPassengerTest.cs b/src/KdtTests/Models/KondutoPassengerTest.cs similarity index 100% rename from KdtTests/Models/KondutoPassengerTest.cs rename to src/KdtTests/Models/KondutoPassengerTest.cs diff --git a/KdtTests/Models/KondutoPaymentTest.cs b/src/KdtTests/Models/KondutoPaymentTest.cs similarity index 100% rename from KdtTests/Models/KondutoPaymentTest.cs rename to src/KdtTests/Models/KondutoPaymentTest.cs diff --git a/KdtTests/Models/KondutoSellerTest.cs b/src/KdtTests/Models/KondutoSellerTest.cs similarity index 100% rename from KdtTests/Models/KondutoSellerTest.cs rename to src/KdtTests/Models/KondutoSellerTest.cs diff --git a/KdtTests/Models/KondutoTravelTest.cs b/src/KdtTests/Models/KondutoTravelTest.cs similarity index 100% rename from KdtTests/Models/KondutoTravelTest.cs rename to src/KdtTests/Models/KondutoTravelTest.cs diff --git a/KdtTests/Properties/Resources.cs b/src/KdtTests/Properties/Resources.cs similarity index 100% rename from KdtTests/Properties/Resources.cs rename to src/KdtTests/Properties/Resources.cs diff --git a/KdtTests/Resources/address.txt b/src/KdtTests/Resources/address.txt similarity index 100% rename from KdtTests/Resources/address.txt rename to src/KdtTests/Resources/address.txt diff --git a/KdtTests/Resources/customer.txt b/src/KdtTests/Resources/customer.txt similarity index 100% rename from KdtTests/Resources/customer.txt rename to src/KdtTests/Resources/customer.txt diff --git a/KdtTests/Resources/device.txt b/src/KdtTests/Resources/device.txt similarity index 100% rename from KdtTests/Resources/device.txt rename to src/KdtTests/Resources/device.txt diff --git a/KdtTests/Resources/flight.txt b/src/KdtTests/Resources/flight.txt similarity index 100% rename from KdtTests/Resources/flight.txt rename to src/KdtTests/Resources/flight.txt diff --git a/KdtTests/Resources/geolocation.txt b/src/KdtTests/Resources/geolocation.txt similarity index 100% rename from KdtTests/Resources/geolocation.txt rename to src/KdtTests/Resources/geolocation.txt diff --git a/KdtTests/Resources/konduto_order.txt b/src/KdtTests/Resources/konduto_order.txt similarity index 100% rename from KdtTests/Resources/konduto_order.txt rename to src/KdtTests/Resources/konduto_order.txt diff --git a/KdtTests/Resources/navigation.txt b/src/KdtTests/Resources/navigation.txt similarity index 100% rename from KdtTests/Resources/navigation.txt rename to src/KdtTests/Resources/navigation.txt diff --git a/KdtTests/Resources/order.txt b/src/KdtTests/Resources/order.txt similarity index 100% rename from KdtTests/Resources/order.txt rename to src/KdtTests/Resources/order.txt diff --git a/KdtTests/Resources/order_not_analyzed.txt b/src/KdtTests/Resources/order_not_analyzed.txt similarity index 100% rename from KdtTests/Resources/order_not_analyzed.txt rename to src/KdtTests/Resources/order_not_analyzed.txt diff --git a/KdtTests/Resources/passenger.txt b/src/KdtTests/Resources/passenger.txt similarity index 100% rename from KdtTests/Resources/passenger.txt rename to src/KdtTests/Resources/passenger.txt diff --git a/KdtTests/Resources/payments.txt b/src/KdtTests/Resources/payments.txt similarity index 100% rename from KdtTests/Resources/payments.txt rename to src/KdtTests/Resources/payments.txt diff --git a/KdtTests/Resources/seller.txt b/src/KdtTests/Resources/seller.txt similarity index 100% rename from KdtTests/Resources/seller.txt rename to src/KdtTests/Resources/seller.txt diff --git a/KdtTests/Resources/shopping_cart.txt b/src/KdtTests/Resources/shopping_cart.txt similarity index 100% rename from KdtTests/Resources/shopping_cart.txt rename to src/KdtTests/Resources/shopping_cart.txt diff --git a/KdtTests/app.config b/src/KdtTests/app.config similarity index 100% rename from KdtTests/app.config rename to src/KdtTests/app.config diff --git a/KdtTests/packages.config b/src/KdtTests/packages.config similarity index 100% rename from KdtTests/packages.config rename to src/KdtTests/packages.config diff --git a/KdtTests/project.json b/src/KdtTests/project.json similarity index 100% rename from KdtTests/project.json rename to src/KdtTests/project.json From c015d5790e95e18c0ec1d6c10a69a03145764d53 Mon Sep 17 00:00:00 2001 From: Daniel Wendhausen Date: Fri, 16 Jun 2017 10:39:36 -0300 Subject: [PATCH 16/21] Move project files to a src folder --- global.json | 2 +- KdtSdk.sln => src/KdtSdk.sln | 0 {KdtSdk => src/KdtSdk}/Exceptions/KondutoException.cs | 0 {KdtSdk => src/KdtSdk}/Exceptions/KondutoHTTPException.cs | 0 .../KdtSdk}/Exceptions/KondutoHTTPExceptionFactory.cs | 0 .../KdtSdk}/Exceptions/KondutoInvalidEntityException.cs | 0 .../KdtSdk}/Exceptions/KondutoUnexpectedAPIRespondeException.cs | 0 {KdtSdk => src/KdtSdk}/KdtSdk.xproj | 0 {KdtSdk => src/KdtSdk}/Konduto.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoAddress.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoBoletoPayment.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoCreditCardPayment.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoCreditCardPaymentStatus.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoCustomer.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoDebitPayment.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoDevice.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoGeolocation.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoItem.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoLoyaltyProgram.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoModel.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoNavigationInfo.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoOrder.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoOrderResponse.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoOrderStatus.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoPassenger.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoPayment.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoPaymentType.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoRecommendation.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoSeller.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoTransferPayment.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoTravel.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoTravelInformation.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoTravelType.cs | 0 {KdtSdk => src/KdtSdk}/Models/KondutoVoucherPayment.cs | 0 {KdtSdk => src/KdtSdk}/Utils/KondutoUtils.cs | 0 {KdtSdk => src/KdtSdk}/app.config | 0 {KdtSdk => src/KdtSdk}/project.json | 0 .../KdtTests}/Exceptions/KondutoHTTPExceptionFactoryTest.cs | 0 .../KdtTests}/Exceptions/KondutoHTTPExceptionTest.cs | 0 .../KdtTests}/Exceptions/KondutoInvalidEntityExceptionTest.cs | 0 .../KdtTests}/Exceptions/KondutoUnexpectedAPIResponseTest.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoAddressFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoCustomerFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoDeviceFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoFlightFactory.cs | 0 .../KdtTests}/Factories/KondutoGeolocationFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoItemFactory.cs | 0 .../KdtTests}/Factories/KondutoNavigationInfoFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoOrderFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoPassengerFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoPaymentFactory.cs | 0 {KdtTests => src/KdtTests}/Factories/KondutoSellerFactory.cs | 0 {KdtTests => src/KdtTests}/KdtTests.xproj | 0 {KdtTests => src/KdtTests}/KondutoTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoAddressTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoBoletoPaymentTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoCustomerTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoDeviceTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoGeolocationTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoItemTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoNavigationInfoTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoOrderTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoPassengerTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoPaymentTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoSellerTest.cs | 0 {KdtTests => src/KdtTests}/Models/KondutoTravelTest.cs | 0 {KdtTests => src/KdtTests}/Properties/Resources.cs | 0 {KdtTests => src/KdtTests}/Resources/address.txt | 0 {KdtTests => src/KdtTests}/Resources/customer.txt | 0 {KdtTests => src/KdtTests}/Resources/device.txt | 0 {KdtTests => src/KdtTests}/Resources/flight.txt | 0 {KdtTests => src/KdtTests}/Resources/geolocation.txt | 0 {KdtTests => src/KdtTests}/Resources/konduto_order.txt | 0 {KdtTests => src/KdtTests}/Resources/navigation.txt | 0 {KdtTests => src/KdtTests}/Resources/order.txt | 0 {KdtTests => src/KdtTests}/Resources/order_not_analyzed.txt | 0 {KdtTests => src/KdtTests}/Resources/passenger.txt | 0 {KdtTests => src/KdtTests}/Resources/payments.txt | 0 {KdtTests => src/KdtTests}/Resources/seller.txt | 0 {KdtTests => src/KdtTests}/Resources/shopping_cart.txt | 0 {KdtTests => src/KdtTests}/app.config | 0 {KdtTests => src/KdtTests}/packages.config | 0 {KdtTests => src/KdtTests}/project.json | 0 83 files changed, 1 insertion(+), 1 deletion(-) rename KdtSdk.sln => src/KdtSdk.sln (100%) rename {KdtSdk => src/KdtSdk}/Exceptions/KondutoException.cs (100%) rename {KdtSdk => src/KdtSdk}/Exceptions/KondutoHTTPException.cs (100%) rename {KdtSdk => src/KdtSdk}/Exceptions/KondutoHTTPExceptionFactory.cs (100%) rename {KdtSdk => src/KdtSdk}/Exceptions/KondutoInvalidEntityException.cs (100%) rename {KdtSdk => src/KdtSdk}/Exceptions/KondutoUnexpectedAPIRespondeException.cs (100%) rename {KdtSdk => src/KdtSdk}/KdtSdk.xproj (100%) rename {KdtSdk => src/KdtSdk}/Konduto.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoAddress.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoBoletoPayment.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoCreditCardPayment.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoCreditCardPaymentStatus.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoCustomer.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoDebitPayment.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoDevice.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoGeolocation.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoItem.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoLoyaltyProgram.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoModel.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoNavigationInfo.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoOrder.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoOrderResponse.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoOrderStatus.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoPassenger.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoPayment.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoPaymentType.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoRecommendation.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoSeller.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoTransferPayment.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoTravel.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoTravelInformation.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoTravelType.cs (100%) rename {KdtSdk => src/KdtSdk}/Models/KondutoVoucherPayment.cs (100%) rename {KdtSdk => src/KdtSdk}/Utils/KondutoUtils.cs (100%) rename {KdtSdk => src/KdtSdk}/app.config (100%) rename {KdtSdk => src/KdtSdk}/project.json (100%) rename {KdtTests => src/KdtTests}/Exceptions/KondutoHTTPExceptionFactoryTest.cs (100%) rename {KdtTests => src/KdtTests}/Exceptions/KondutoHTTPExceptionTest.cs (100%) rename {KdtTests => src/KdtTests}/Exceptions/KondutoInvalidEntityExceptionTest.cs (100%) rename {KdtTests => src/KdtTests}/Exceptions/KondutoUnexpectedAPIResponseTest.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoAddressFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoCustomerFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoDeviceFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoFlightFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoGeolocationFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoItemFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoNavigationInfoFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoOrderFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoPassengerFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoPaymentFactory.cs (100%) rename {KdtTests => src/KdtTests}/Factories/KondutoSellerFactory.cs (100%) rename {KdtTests => src/KdtTests}/KdtTests.xproj (100%) rename {KdtTests => src/KdtTests}/KondutoTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoAddressTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoBoletoPaymentTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoCustomerTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoDeviceTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoGeolocationTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoItemTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoNavigationInfoTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoOrderTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoPassengerTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoPaymentTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoSellerTest.cs (100%) rename {KdtTests => src/KdtTests}/Models/KondutoTravelTest.cs (100%) rename {KdtTests => src/KdtTests}/Properties/Resources.cs (100%) rename {KdtTests => src/KdtTests}/Resources/address.txt (100%) rename {KdtTests => src/KdtTests}/Resources/customer.txt (100%) rename {KdtTests => src/KdtTests}/Resources/device.txt (100%) rename {KdtTests => src/KdtTests}/Resources/flight.txt (100%) rename {KdtTests => src/KdtTests}/Resources/geolocation.txt (100%) rename {KdtTests => src/KdtTests}/Resources/konduto_order.txt (100%) rename {KdtTests => src/KdtTests}/Resources/navigation.txt (100%) rename {KdtTests => src/KdtTests}/Resources/order.txt (100%) rename {KdtTests => src/KdtTests}/Resources/order_not_analyzed.txt (100%) rename {KdtTests => src/KdtTests}/Resources/passenger.txt (100%) rename {KdtTests => src/KdtTests}/Resources/payments.txt (100%) rename {KdtTests => src/KdtTests}/Resources/seller.txt (100%) rename {KdtTests => src/KdtTests}/Resources/shopping_cart.txt (100%) rename {KdtTests => src/KdtTests}/app.config (100%) rename {KdtTests => src/KdtTests}/packages.config (100%) rename {KdtTests => src/KdtTests}/project.json (100%) diff --git a/global.json b/global.json index 1c57463..013e7c6 100644 --- a/global.json +++ b/global.json @@ -1,5 +1,5 @@ { - "projects": ["KdtSdk", "KdtTests"], + "projects": ["src"], "sdk": { "version": "1.0.0-preview2-003121" } diff --git a/KdtSdk.sln b/src/KdtSdk.sln similarity index 100% rename from KdtSdk.sln rename to src/KdtSdk.sln diff --git a/KdtSdk/Exceptions/KondutoException.cs b/src/KdtSdk/Exceptions/KondutoException.cs similarity index 100% rename from KdtSdk/Exceptions/KondutoException.cs rename to src/KdtSdk/Exceptions/KondutoException.cs diff --git a/KdtSdk/Exceptions/KondutoHTTPException.cs b/src/KdtSdk/Exceptions/KondutoHTTPException.cs similarity index 100% rename from KdtSdk/Exceptions/KondutoHTTPException.cs rename to src/KdtSdk/Exceptions/KondutoHTTPException.cs diff --git a/KdtSdk/Exceptions/KondutoHTTPExceptionFactory.cs b/src/KdtSdk/Exceptions/KondutoHTTPExceptionFactory.cs similarity index 100% rename from KdtSdk/Exceptions/KondutoHTTPExceptionFactory.cs rename to src/KdtSdk/Exceptions/KondutoHTTPExceptionFactory.cs diff --git a/KdtSdk/Exceptions/KondutoInvalidEntityException.cs b/src/KdtSdk/Exceptions/KondutoInvalidEntityException.cs similarity index 100% rename from KdtSdk/Exceptions/KondutoInvalidEntityException.cs rename to src/KdtSdk/Exceptions/KondutoInvalidEntityException.cs diff --git a/KdtSdk/Exceptions/KondutoUnexpectedAPIRespondeException.cs b/src/KdtSdk/Exceptions/KondutoUnexpectedAPIRespondeException.cs similarity index 100% rename from KdtSdk/Exceptions/KondutoUnexpectedAPIRespondeException.cs rename to src/KdtSdk/Exceptions/KondutoUnexpectedAPIRespondeException.cs diff --git a/KdtSdk/KdtSdk.xproj b/src/KdtSdk/KdtSdk.xproj similarity index 100% rename from KdtSdk/KdtSdk.xproj rename to src/KdtSdk/KdtSdk.xproj diff --git a/KdtSdk/Konduto.cs b/src/KdtSdk/Konduto.cs similarity index 100% rename from KdtSdk/Konduto.cs rename to src/KdtSdk/Konduto.cs diff --git a/KdtSdk/Models/KondutoAddress.cs b/src/KdtSdk/Models/KondutoAddress.cs similarity index 100% rename from KdtSdk/Models/KondutoAddress.cs rename to src/KdtSdk/Models/KondutoAddress.cs diff --git a/KdtSdk/Models/KondutoBoletoPayment.cs b/src/KdtSdk/Models/KondutoBoletoPayment.cs similarity index 100% rename from KdtSdk/Models/KondutoBoletoPayment.cs rename to src/KdtSdk/Models/KondutoBoletoPayment.cs diff --git a/KdtSdk/Models/KondutoCreditCardPayment.cs b/src/KdtSdk/Models/KondutoCreditCardPayment.cs similarity index 100% rename from KdtSdk/Models/KondutoCreditCardPayment.cs rename to src/KdtSdk/Models/KondutoCreditCardPayment.cs diff --git a/KdtSdk/Models/KondutoCreditCardPaymentStatus.cs b/src/KdtSdk/Models/KondutoCreditCardPaymentStatus.cs similarity index 100% rename from KdtSdk/Models/KondutoCreditCardPaymentStatus.cs rename to src/KdtSdk/Models/KondutoCreditCardPaymentStatus.cs diff --git a/KdtSdk/Models/KondutoCustomer.cs b/src/KdtSdk/Models/KondutoCustomer.cs similarity index 100% rename from KdtSdk/Models/KondutoCustomer.cs rename to src/KdtSdk/Models/KondutoCustomer.cs diff --git a/KdtSdk/Models/KondutoDebitPayment.cs b/src/KdtSdk/Models/KondutoDebitPayment.cs similarity index 100% rename from KdtSdk/Models/KondutoDebitPayment.cs rename to src/KdtSdk/Models/KondutoDebitPayment.cs diff --git a/KdtSdk/Models/KondutoDevice.cs b/src/KdtSdk/Models/KondutoDevice.cs similarity index 100% rename from KdtSdk/Models/KondutoDevice.cs rename to src/KdtSdk/Models/KondutoDevice.cs diff --git a/KdtSdk/Models/KondutoGeolocation.cs b/src/KdtSdk/Models/KondutoGeolocation.cs similarity index 100% rename from KdtSdk/Models/KondutoGeolocation.cs rename to src/KdtSdk/Models/KondutoGeolocation.cs diff --git a/KdtSdk/Models/KondutoItem.cs b/src/KdtSdk/Models/KondutoItem.cs similarity index 100% rename from KdtSdk/Models/KondutoItem.cs rename to src/KdtSdk/Models/KondutoItem.cs diff --git a/KdtSdk/Models/KondutoLoyaltyProgram.cs b/src/KdtSdk/Models/KondutoLoyaltyProgram.cs similarity index 100% rename from KdtSdk/Models/KondutoLoyaltyProgram.cs rename to src/KdtSdk/Models/KondutoLoyaltyProgram.cs diff --git a/KdtSdk/Models/KondutoModel.cs b/src/KdtSdk/Models/KondutoModel.cs similarity index 100% rename from KdtSdk/Models/KondutoModel.cs rename to src/KdtSdk/Models/KondutoModel.cs diff --git a/KdtSdk/Models/KondutoNavigationInfo.cs b/src/KdtSdk/Models/KondutoNavigationInfo.cs similarity index 100% rename from KdtSdk/Models/KondutoNavigationInfo.cs rename to src/KdtSdk/Models/KondutoNavigationInfo.cs diff --git a/KdtSdk/Models/KondutoOrder.cs b/src/KdtSdk/Models/KondutoOrder.cs similarity index 100% rename from KdtSdk/Models/KondutoOrder.cs rename to src/KdtSdk/Models/KondutoOrder.cs diff --git a/KdtSdk/Models/KondutoOrderResponse.cs b/src/KdtSdk/Models/KondutoOrderResponse.cs similarity index 100% rename from KdtSdk/Models/KondutoOrderResponse.cs rename to src/KdtSdk/Models/KondutoOrderResponse.cs diff --git a/KdtSdk/Models/KondutoOrderStatus.cs b/src/KdtSdk/Models/KondutoOrderStatus.cs similarity index 100% rename from KdtSdk/Models/KondutoOrderStatus.cs rename to src/KdtSdk/Models/KondutoOrderStatus.cs diff --git a/KdtSdk/Models/KondutoPassenger.cs b/src/KdtSdk/Models/KondutoPassenger.cs similarity index 100% rename from KdtSdk/Models/KondutoPassenger.cs rename to src/KdtSdk/Models/KondutoPassenger.cs diff --git a/KdtSdk/Models/KondutoPayment.cs b/src/KdtSdk/Models/KondutoPayment.cs similarity index 100% rename from KdtSdk/Models/KondutoPayment.cs rename to src/KdtSdk/Models/KondutoPayment.cs diff --git a/KdtSdk/Models/KondutoPaymentType.cs b/src/KdtSdk/Models/KondutoPaymentType.cs similarity index 100% rename from KdtSdk/Models/KondutoPaymentType.cs rename to src/KdtSdk/Models/KondutoPaymentType.cs diff --git a/KdtSdk/Models/KondutoRecommendation.cs b/src/KdtSdk/Models/KondutoRecommendation.cs similarity index 100% rename from KdtSdk/Models/KondutoRecommendation.cs rename to src/KdtSdk/Models/KondutoRecommendation.cs diff --git a/KdtSdk/Models/KondutoSeller.cs b/src/KdtSdk/Models/KondutoSeller.cs similarity index 100% rename from KdtSdk/Models/KondutoSeller.cs rename to src/KdtSdk/Models/KondutoSeller.cs diff --git a/KdtSdk/Models/KondutoTransferPayment.cs b/src/KdtSdk/Models/KondutoTransferPayment.cs similarity index 100% rename from KdtSdk/Models/KondutoTransferPayment.cs rename to src/KdtSdk/Models/KondutoTransferPayment.cs diff --git a/KdtSdk/Models/KondutoTravel.cs b/src/KdtSdk/Models/KondutoTravel.cs similarity index 100% rename from KdtSdk/Models/KondutoTravel.cs rename to src/KdtSdk/Models/KondutoTravel.cs diff --git a/KdtSdk/Models/KondutoTravelInformation.cs b/src/KdtSdk/Models/KondutoTravelInformation.cs similarity index 100% rename from KdtSdk/Models/KondutoTravelInformation.cs rename to src/KdtSdk/Models/KondutoTravelInformation.cs diff --git a/KdtSdk/Models/KondutoTravelType.cs b/src/KdtSdk/Models/KondutoTravelType.cs similarity index 100% rename from KdtSdk/Models/KondutoTravelType.cs rename to src/KdtSdk/Models/KondutoTravelType.cs diff --git a/KdtSdk/Models/KondutoVoucherPayment.cs b/src/KdtSdk/Models/KondutoVoucherPayment.cs similarity index 100% rename from KdtSdk/Models/KondutoVoucherPayment.cs rename to src/KdtSdk/Models/KondutoVoucherPayment.cs diff --git a/KdtSdk/Utils/KondutoUtils.cs b/src/KdtSdk/Utils/KondutoUtils.cs similarity index 100% rename from KdtSdk/Utils/KondutoUtils.cs rename to src/KdtSdk/Utils/KondutoUtils.cs diff --git a/KdtSdk/app.config b/src/KdtSdk/app.config similarity index 100% rename from KdtSdk/app.config rename to src/KdtSdk/app.config diff --git a/KdtSdk/project.json b/src/KdtSdk/project.json similarity index 100% rename from KdtSdk/project.json rename to src/KdtSdk/project.json diff --git a/KdtTests/Exceptions/KondutoHTTPExceptionFactoryTest.cs b/src/KdtTests/Exceptions/KondutoHTTPExceptionFactoryTest.cs similarity index 100% rename from KdtTests/Exceptions/KondutoHTTPExceptionFactoryTest.cs rename to src/KdtTests/Exceptions/KondutoHTTPExceptionFactoryTest.cs diff --git a/KdtTests/Exceptions/KondutoHTTPExceptionTest.cs b/src/KdtTests/Exceptions/KondutoHTTPExceptionTest.cs similarity index 100% rename from KdtTests/Exceptions/KondutoHTTPExceptionTest.cs rename to src/KdtTests/Exceptions/KondutoHTTPExceptionTest.cs diff --git a/KdtTests/Exceptions/KondutoInvalidEntityExceptionTest.cs b/src/KdtTests/Exceptions/KondutoInvalidEntityExceptionTest.cs similarity index 100% rename from KdtTests/Exceptions/KondutoInvalidEntityExceptionTest.cs rename to src/KdtTests/Exceptions/KondutoInvalidEntityExceptionTest.cs diff --git a/KdtTests/Exceptions/KondutoUnexpectedAPIResponseTest.cs b/src/KdtTests/Exceptions/KondutoUnexpectedAPIResponseTest.cs similarity index 100% rename from KdtTests/Exceptions/KondutoUnexpectedAPIResponseTest.cs rename to src/KdtTests/Exceptions/KondutoUnexpectedAPIResponseTest.cs diff --git a/KdtTests/Factories/KondutoAddressFactory.cs b/src/KdtTests/Factories/KondutoAddressFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoAddressFactory.cs rename to src/KdtTests/Factories/KondutoAddressFactory.cs diff --git a/KdtTests/Factories/KondutoCustomerFactory.cs b/src/KdtTests/Factories/KondutoCustomerFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoCustomerFactory.cs rename to src/KdtTests/Factories/KondutoCustomerFactory.cs diff --git a/KdtTests/Factories/KondutoDeviceFactory.cs b/src/KdtTests/Factories/KondutoDeviceFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoDeviceFactory.cs rename to src/KdtTests/Factories/KondutoDeviceFactory.cs diff --git a/KdtTests/Factories/KondutoFlightFactory.cs b/src/KdtTests/Factories/KondutoFlightFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoFlightFactory.cs rename to src/KdtTests/Factories/KondutoFlightFactory.cs diff --git a/KdtTests/Factories/KondutoGeolocationFactory.cs b/src/KdtTests/Factories/KondutoGeolocationFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoGeolocationFactory.cs rename to src/KdtTests/Factories/KondutoGeolocationFactory.cs diff --git a/KdtTests/Factories/KondutoItemFactory.cs b/src/KdtTests/Factories/KondutoItemFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoItemFactory.cs rename to src/KdtTests/Factories/KondutoItemFactory.cs diff --git a/KdtTests/Factories/KondutoNavigationInfoFactory.cs b/src/KdtTests/Factories/KondutoNavigationInfoFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoNavigationInfoFactory.cs rename to src/KdtTests/Factories/KondutoNavigationInfoFactory.cs diff --git a/KdtTests/Factories/KondutoOrderFactory.cs b/src/KdtTests/Factories/KondutoOrderFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoOrderFactory.cs rename to src/KdtTests/Factories/KondutoOrderFactory.cs diff --git a/KdtTests/Factories/KondutoPassengerFactory.cs b/src/KdtTests/Factories/KondutoPassengerFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoPassengerFactory.cs rename to src/KdtTests/Factories/KondutoPassengerFactory.cs diff --git a/KdtTests/Factories/KondutoPaymentFactory.cs b/src/KdtTests/Factories/KondutoPaymentFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoPaymentFactory.cs rename to src/KdtTests/Factories/KondutoPaymentFactory.cs diff --git a/KdtTests/Factories/KondutoSellerFactory.cs b/src/KdtTests/Factories/KondutoSellerFactory.cs similarity index 100% rename from KdtTests/Factories/KondutoSellerFactory.cs rename to src/KdtTests/Factories/KondutoSellerFactory.cs diff --git a/KdtTests/KdtTests.xproj b/src/KdtTests/KdtTests.xproj similarity index 100% rename from KdtTests/KdtTests.xproj rename to src/KdtTests/KdtTests.xproj diff --git a/KdtTests/KondutoTest.cs b/src/KdtTests/KondutoTest.cs similarity index 100% rename from KdtTests/KondutoTest.cs rename to src/KdtTests/KondutoTest.cs diff --git a/KdtTests/Models/KondutoAddressTest.cs b/src/KdtTests/Models/KondutoAddressTest.cs similarity index 100% rename from KdtTests/Models/KondutoAddressTest.cs rename to src/KdtTests/Models/KondutoAddressTest.cs diff --git a/KdtTests/Models/KondutoBoletoPaymentTest.cs b/src/KdtTests/Models/KondutoBoletoPaymentTest.cs similarity index 100% rename from KdtTests/Models/KondutoBoletoPaymentTest.cs rename to src/KdtTests/Models/KondutoBoletoPaymentTest.cs diff --git a/KdtTests/Models/KondutoCustomerTest.cs b/src/KdtTests/Models/KondutoCustomerTest.cs similarity index 100% rename from KdtTests/Models/KondutoCustomerTest.cs rename to src/KdtTests/Models/KondutoCustomerTest.cs diff --git a/KdtTests/Models/KondutoDeviceTest.cs b/src/KdtTests/Models/KondutoDeviceTest.cs similarity index 100% rename from KdtTests/Models/KondutoDeviceTest.cs rename to src/KdtTests/Models/KondutoDeviceTest.cs diff --git a/KdtTests/Models/KondutoGeolocationTest.cs b/src/KdtTests/Models/KondutoGeolocationTest.cs similarity index 100% rename from KdtTests/Models/KondutoGeolocationTest.cs rename to src/KdtTests/Models/KondutoGeolocationTest.cs diff --git a/KdtTests/Models/KondutoItemTest.cs b/src/KdtTests/Models/KondutoItemTest.cs similarity index 100% rename from KdtTests/Models/KondutoItemTest.cs rename to src/KdtTests/Models/KondutoItemTest.cs diff --git a/KdtTests/Models/KondutoNavigationInfoTest.cs b/src/KdtTests/Models/KondutoNavigationInfoTest.cs similarity index 100% rename from KdtTests/Models/KondutoNavigationInfoTest.cs rename to src/KdtTests/Models/KondutoNavigationInfoTest.cs diff --git a/KdtTests/Models/KondutoOrderTest.cs b/src/KdtTests/Models/KondutoOrderTest.cs similarity index 100% rename from KdtTests/Models/KondutoOrderTest.cs rename to src/KdtTests/Models/KondutoOrderTest.cs diff --git a/KdtTests/Models/KondutoPassengerTest.cs b/src/KdtTests/Models/KondutoPassengerTest.cs similarity index 100% rename from KdtTests/Models/KondutoPassengerTest.cs rename to src/KdtTests/Models/KondutoPassengerTest.cs diff --git a/KdtTests/Models/KondutoPaymentTest.cs b/src/KdtTests/Models/KondutoPaymentTest.cs similarity index 100% rename from KdtTests/Models/KondutoPaymentTest.cs rename to src/KdtTests/Models/KondutoPaymentTest.cs diff --git a/KdtTests/Models/KondutoSellerTest.cs b/src/KdtTests/Models/KondutoSellerTest.cs similarity index 100% rename from KdtTests/Models/KondutoSellerTest.cs rename to src/KdtTests/Models/KondutoSellerTest.cs diff --git a/KdtTests/Models/KondutoTravelTest.cs b/src/KdtTests/Models/KondutoTravelTest.cs similarity index 100% rename from KdtTests/Models/KondutoTravelTest.cs rename to src/KdtTests/Models/KondutoTravelTest.cs diff --git a/KdtTests/Properties/Resources.cs b/src/KdtTests/Properties/Resources.cs similarity index 100% rename from KdtTests/Properties/Resources.cs rename to src/KdtTests/Properties/Resources.cs diff --git a/KdtTests/Resources/address.txt b/src/KdtTests/Resources/address.txt similarity index 100% rename from KdtTests/Resources/address.txt rename to src/KdtTests/Resources/address.txt diff --git a/KdtTests/Resources/customer.txt b/src/KdtTests/Resources/customer.txt similarity index 100% rename from KdtTests/Resources/customer.txt rename to src/KdtTests/Resources/customer.txt diff --git a/KdtTests/Resources/device.txt b/src/KdtTests/Resources/device.txt similarity index 100% rename from KdtTests/Resources/device.txt rename to src/KdtTests/Resources/device.txt diff --git a/KdtTests/Resources/flight.txt b/src/KdtTests/Resources/flight.txt similarity index 100% rename from KdtTests/Resources/flight.txt rename to src/KdtTests/Resources/flight.txt diff --git a/KdtTests/Resources/geolocation.txt b/src/KdtTests/Resources/geolocation.txt similarity index 100% rename from KdtTests/Resources/geolocation.txt rename to src/KdtTests/Resources/geolocation.txt diff --git a/KdtTests/Resources/konduto_order.txt b/src/KdtTests/Resources/konduto_order.txt similarity index 100% rename from KdtTests/Resources/konduto_order.txt rename to src/KdtTests/Resources/konduto_order.txt diff --git a/KdtTests/Resources/navigation.txt b/src/KdtTests/Resources/navigation.txt similarity index 100% rename from KdtTests/Resources/navigation.txt rename to src/KdtTests/Resources/navigation.txt diff --git a/KdtTests/Resources/order.txt b/src/KdtTests/Resources/order.txt similarity index 100% rename from KdtTests/Resources/order.txt rename to src/KdtTests/Resources/order.txt diff --git a/KdtTests/Resources/order_not_analyzed.txt b/src/KdtTests/Resources/order_not_analyzed.txt similarity index 100% rename from KdtTests/Resources/order_not_analyzed.txt rename to src/KdtTests/Resources/order_not_analyzed.txt diff --git a/KdtTests/Resources/passenger.txt b/src/KdtTests/Resources/passenger.txt similarity index 100% rename from KdtTests/Resources/passenger.txt rename to src/KdtTests/Resources/passenger.txt diff --git a/KdtTests/Resources/payments.txt b/src/KdtTests/Resources/payments.txt similarity index 100% rename from KdtTests/Resources/payments.txt rename to src/KdtTests/Resources/payments.txt diff --git a/KdtTests/Resources/seller.txt b/src/KdtTests/Resources/seller.txt similarity index 100% rename from KdtTests/Resources/seller.txt rename to src/KdtTests/Resources/seller.txt diff --git a/KdtTests/Resources/shopping_cart.txt b/src/KdtTests/Resources/shopping_cart.txt similarity index 100% rename from KdtTests/Resources/shopping_cart.txt rename to src/KdtTests/Resources/shopping_cart.txt diff --git a/KdtTests/app.config b/src/KdtTests/app.config similarity index 100% rename from KdtTests/app.config rename to src/KdtTests/app.config diff --git a/KdtTests/packages.config b/src/KdtTests/packages.config similarity index 100% rename from KdtTests/packages.config rename to src/KdtTests/packages.config diff --git a/KdtTests/project.json b/src/KdtTests/project.json similarity index 100% rename from KdtTests/project.json rename to src/KdtTests/project.json From e249f41603d56ea7b9eca7439f11bf918ccd03a7 Mon Sep 17 00:00:00 2001 From: Luiz Guilherme Bauer Fraga Moreira Date: Wed, 21 Jun 2017 11:00:13 -0300 Subject: [PATCH 17/21] Migrate to msbuild --- global.json | 6 ------ src/KdtSdk/KdtSdk.csproj | 28 ++++++++++++++++++++++++++++ src/KdtSdk/KdtSdk.xproj | 19 ------------------- src/KdtSdk/project.json | 21 --------------------- src/KdtTests/KdtTests.csproj | 35 +++++++++++++++++++++++++++++++++++ src/KdtTests/KdtTests.xproj | 21 --------------------- src/KdtTests/project.json | 35 ----------------------------------- 7 files changed, 63 insertions(+), 102 deletions(-) delete mode 100644 global.json create mode 100644 src/KdtSdk/KdtSdk.csproj delete mode 100644 src/KdtSdk/KdtSdk.xproj delete mode 100644 src/KdtSdk/project.json create mode 100644 src/KdtTests/KdtTests.csproj delete mode 100644 src/KdtTests/KdtTests.xproj delete mode 100644 src/KdtTests/project.json diff --git a/global.json b/global.json deleted file mode 100644 index 013e7c6..0000000 --- a/global.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "projects": ["src"], - "sdk": { - "version": "1.0.0-preview2-003121" - } -} diff --git a/src/KdtSdk/KdtSdk.csproj b/src/KdtSdk/KdtSdk.csproj new file mode 100644 index 0000000..4632e01 --- /dev/null +++ b/src/KdtSdk/KdtSdk.csproj @@ -0,0 +1,28 @@ + + + + A sdk to interact with Konduto's api + Copyright © 2015 + KdtSdk + 1.1.0 + Konduto + net45;netstandard1.3 + KdtSdk + KdtSdk + + + + + + + + + + + + + + + + + diff --git a/src/KdtSdk/KdtSdk.xproj b/src/KdtSdk/KdtSdk.xproj deleted file mode 100644 index 7d1db17..0000000 --- a/src/KdtSdk/KdtSdk.xproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 7a60d91b-45a0-4dd4-a6eb-6064c6ddeb6b - KdtSdk - .\obj - .\bin\ - - - - 2.0 - - - \ No newline at end of file diff --git a/src/KdtSdk/project.json b/src/KdtSdk/project.json deleted file mode 100644 index 1d0ff61..0000000 --- a/src/KdtSdk/project.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "title": "KdtSdk", - "description": "A sdk to interact with Konduto's api", - "authors": ["Konduto"], - "copyright": "Copyright © 2015", - "version": "1.1.0", - - "dependencies": { - "System.Net.Http": "4.1.0", - "Newtonsoft.Json": "10.0.1" - }, - "frameworks": { - "net45": {}, - "netstandard1.3": { - "imports": [ - "portable-net45+win8", - "netstandard1.6" - ] - } - } -} diff --git a/src/KdtTests/KdtTests.csproj b/src/KdtTests/KdtTests.csproj new file mode 100644 index 0000000..bbc2532 --- /dev/null +++ b/src/KdtTests/KdtTests.csproj @@ -0,0 +1,35 @@ + + + + Copyright © 2015 + KdtTests + 1.1.0 + Konduto + netcoreapp1.0 + KdtTests + KdtTests + true + 1.0.4 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/KdtTests/KdtTests.xproj b/src/KdtTests/KdtTests.xproj deleted file mode 100644 index adc64eb..0000000 --- a/src/KdtTests/KdtTests.xproj +++ /dev/null @@ -1,21 +0,0 @@ - - - - 14.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - 30579b8d-ae9e-483f-a7da-66fcfffdd9da - KdtTests - .\obj - .\bin\ - - - 2.0 - - - - - - \ No newline at end of file diff --git a/src/KdtTests/project.json b/src/KdtTests/project.json deleted file mode 100644 index 7c8404f..0000000 --- a/src/KdtTests/project.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "title": "KdtTests", - "authors": ["Konduto"], - "copyright": "Copyright © 2015", - "version": "1.1.0", - - "testRunner": "xunit", - "dependencies": { - "KdtSdk": "1.1.0", - "xunit": "2.2.0-beta2-build3300", - "dotnet-test-xunit": "2.2.0-preview2-build1029", - "System.Diagnostics.TraceSource": "4.0.0-rc2-24027" - }, - "buildOptions": { - "embed": { - "include": [ - "Resources/*.txt" - ] - } - }, - "frameworks": { - "netcoreapp1.0": { - "imports": [ - "portable-net45+win8", - "netstandard1.6" - ], - "dependencies": { - "Microsoft.NETCore.App": { - "type": "platform", - "version": "1.0.0" - } - } - } - } -} From b71c94576e98bdb1e5967e73e55a40eff57781de Mon Sep 17 00:00:00 2001 From: Daniel Wendhausen Date: Tue, 27 Jun 2017 09:48:35 -0300 Subject: [PATCH 18/21] Fix build (Can't build the code for .NET 4.5 on Linux (mono) https://github.com/dotnet/sdk/issues/335) --- src/KdtSdk/KdtSdk.csproj | 10 ++-------- src/KdtTests/KdtTests.csproj | 2 +- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/KdtSdk/KdtSdk.csproj b/src/KdtSdk/KdtSdk.csproj index 4632e01..f6921db 100644 --- a/src/KdtSdk/KdtSdk.csproj +++ b/src/KdtSdk/KdtSdk.csproj @@ -6,23 +6,17 @@ KdtSdk 1.1.0 Konduto - net45;netstandard1.3 + netstandard1.3 KdtSdk KdtSdk - + - - - - - - diff --git a/src/KdtTests/KdtTests.csproj b/src/KdtTests/KdtTests.csproj index bbc2532..826c327 100644 --- a/src/KdtTests/KdtTests.csproj +++ b/src/KdtTests/KdtTests.csproj @@ -14,7 +14,7 @@ - + From 722d4f4dc362513c1449e7f73e47e3e65e40ac7b Mon Sep 17 00:00:00 2001 From: Andre Alves Date: Tue, 13 Nov 2018 09:50:56 -0200 Subject: [PATCH 19/21] Updating solution, netstandar and netcore versions --- src/KdtSdk.sln | 33 +++++++++++++++++++++------------ src/KdtSdk/KdtSdk.csproj | 8 ++------ src/KdtSdk/app.config | 19 ------------------- src/KdtTests/KdtTests.csproj | 23 ++++++++++------------- src/KdtTests/app.config | 11 ----------- src/KdtTests/packages.config | 7 ------- 6 files changed, 33 insertions(+), 68 deletions(-) delete mode 100644 src/KdtSdk/app.config delete mode 100644 src/KdtTests/app.config delete mode 100644 src/KdtTests/packages.config diff --git a/src/KdtSdk.sln b/src/KdtSdk.sln index 543c667..e080402 100644 --- a/src/KdtSdk.sln +++ b/src/KdtSdk.sln @@ -1,11 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.28010.2050 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "KdtSdk", "KdtSdk\KdtSdk.xproj", "{7A60D91B-45A0-4DD4-A6EB-6064C6DDEB6B}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{CAC47624-8884-4855-936B-A0B5E8E7E4CC}" EndProject -Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "KdtTests", "KdtTests\KdtTests.xproj", "{30579B8D-AE9E-483F-A7DA-66FCFFFDD9DA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KdtSdk", "KdtSdk\KdtSdk.csproj", "{73A6BCA3-9019-498C-BE89-DB8233DDC79B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KdtTests", "KdtTests\KdtTests.csproj", "{424BD126-E187-4A6D-808E-B332B0E68026}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -13,16 +15,23 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7A60D91B-45A0-4DD4-A6EB-6064C6DDEB6B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7A60D91B-45A0-4DD4-A6EB-6064C6DDEB6B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7A60D91B-45A0-4DD4-A6EB-6064C6DDEB6B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7A60D91B-45A0-4DD4-A6EB-6064C6DDEB6B}.Release|Any CPU.Build.0 = Release|Any CPU - {30579B8D-AE9E-483F-A7DA-66FCFFFDD9DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {30579B8D-AE9E-483F-A7DA-66FCFFFDD9DA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {30579B8D-AE9E-483F-A7DA-66FCFFFDD9DA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {30579B8D-AE9E-483F-A7DA-66FCFFFDD9DA}.Release|Any CPU.Build.0 = Release|Any CPU + {73A6BCA3-9019-498C-BE89-DB8233DDC79B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {73A6BCA3-9019-498C-BE89-DB8233DDC79B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {73A6BCA3-9019-498C-BE89-DB8233DDC79B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {73A6BCA3-9019-498C-BE89-DB8233DDC79B}.Release|Any CPU.Build.0 = Release|Any CPU + {424BD126-E187-4A6D-808E-B332B0E68026}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {424BD126-E187-4A6D-808E-B332B0E68026}.Debug|Any CPU.Build.0 = Debug|Any CPU + {424BD126-E187-4A6D-808E-B332B0E68026}.Release|Any CPU.ActiveCfg = Release|Any CPU + {424BD126-E187-4A6D-808E-B332B0E68026}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {73A6BCA3-9019-498C-BE89-DB8233DDC79B} = {CAC47624-8884-4855-936B-A0B5E8E7E4CC} + {424BD126-E187-4A6D-808E-B332B0E68026} = {CAC47624-8884-4855-936B-A0B5E8E7E4CC} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4BB89A18-F00C-49D9-A09A-94820829B32B} + EndGlobalSection EndGlobal diff --git a/src/KdtSdk/KdtSdk.csproj b/src/KdtSdk/KdtSdk.csproj index f6921db..7d3b2b1 100644 --- a/src/KdtSdk/KdtSdk.csproj +++ b/src/KdtSdk/KdtSdk.csproj @@ -6,17 +6,13 @@ KdtSdk 1.1.0 Konduto - netstandard1.3 KdtSdk KdtSdk + netstandard2.0 - + - - - - diff --git a/src/KdtSdk/app.config b/src/KdtSdk/app.config deleted file mode 100644 index 0c93fe0..0000000 --- a/src/KdtSdk/app.config +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/src/KdtTests/KdtTests.csproj b/src/KdtTests/KdtTests.csproj index 826c327..c334d84 100644 --- a/src/KdtTests/KdtTests.csproj +++ b/src/KdtTests/KdtTests.csproj @@ -5,31 +5,28 @@ KdtTests 1.1.0 Konduto - netcoreapp1.0 KdtTests KdtTests true - 1.0.4 + netcoreapp2.1 - - + - + + + + + all + runtime; build; native; contentfiles; analyzers + - - - - - - - - + diff --git a/src/KdtTests/app.config b/src/KdtTests/app.config deleted file mode 100644 index 19b1cb9..0000000 --- a/src/KdtTests/app.config +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/KdtTests/packages.config b/src/KdtTests/packages.config deleted file mode 100644 index bf72313..0000000 --- a/src/KdtTests/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file From 6738e0a480320c4ae81bdb86b92f8401b993e44e Mon Sep 17 00:00:00 2001 From: Andre Alves Date: Tue, 13 Nov 2018 09:54:44 -0200 Subject: [PATCH 20/21] Fixing KondutoOrder.Id already exists on tests --- src/KdtTests/KondutoTest.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/KdtTests/KondutoTest.cs b/src/KdtTests/KondutoTest.cs index 72543e9..4e4c999 100644 --- a/src/KdtTests/KondutoTest.cs +++ b/src/KdtTests/KondutoTest.cs @@ -142,7 +142,7 @@ public void PostIntegrationTest() KondutoOrder order = new KondutoOrder { - Id = ((Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds).ToString(), + Id = Guid.NewGuid().ToString(), Visitor = "38a9412f0b01b4dd1762ae424169a3e490d75c7a", TotalAmount = 100.00, Customer = Customer, @@ -230,7 +230,7 @@ public void FullJsonIntegrationTest() KondutoOrder order = new KondutoOrder { - Id = ((Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds).ToString(), + Id = Guid.NewGuid().ToString(), Visitor = "38a9412f0b01b4dd1762ae424169a3e490d75c7a", TotalAmount = 100.00, ShippingAmount = 6.00, @@ -270,7 +270,7 @@ public void PostBoletoIntegrationTest() KondutoOrder order = new KondutoOrder { - Id = ((Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds).ToString(), + Id = Guid.NewGuid().ToString(), Visitor = "38a9412f0b01b4dd1762ae424169a3e490d75c7a", TotalAmount = 100.00, Customer = Customer, @@ -295,7 +295,7 @@ public void PostNonCreditIntegrationTest() KondutoOrder order = new KondutoOrder { - Id = ((Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds).ToString(), + Id = Guid.NewGuid().ToString(), Visitor = "38a9412f0b01b4dd1762ae424169a3e490d75c7a", TotalAmount = 100.00, Customer = Customer, @@ -318,7 +318,7 @@ public void GetIntegrationTest() [Fact] public void PutIntegrationTest() { - var id = $"{((Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds)}"; + var id = $"{Guid.NewGuid()}"; Konduto konduto = new Konduto("T738D516F09CAB3A2C1EE"); KondutoCustomer Customer = new KondutoCustomer From 70aa059373d86de13742a40dc5bda6c7a53c67a1 Mon Sep 17 00:00:00 2001 From: Andre Alves Date: Tue, 13 Nov 2018 10:11:00 -0200 Subject: [PATCH 21/21] Fixing test warning for async --- src/KdtTests/KondutoTest.cs | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/KdtTests/KondutoTest.cs b/src/KdtTests/KondutoTest.cs index 4e4c999..0595e3e 100644 --- a/src/KdtTests/KondutoTest.cs +++ b/src/KdtTests/KondutoTest.cs @@ -460,21 +460,22 @@ public void AddFakeResponse(Uri uri, HttpResponseMessage responseMessage) protected async override Task SendAsync(HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) { - var v = request.Headers.Authorization.Parameter; - - Assert.True(AUTH_HEADER == request.Headers.Authorization.Parameter, "Failing authorizing request."); - - if (_FakeResponses.ContainsKey(request.RequestUri)) - { - return _FakeResponses[request.RequestUri]; - } - else + return await Task.Run(() => { - return new HttpResponseMessage(HttpStatusCode.NotFound) + Assert.True(AUTH_HEADER == request.Headers.Authorization.Parameter, "Failing authorizing request."); + + if (_FakeResponses.ContainsKey(request.RequestUri)) + { + return _FakeResponses[request.RequestUri]; + } + else { - RequestMessage = request - }; - } + return new HttpResponseMessage(HttpStatusCode.NotFound) + { + RequestMessage = request + }; + } + }); } }