diff --git a/src/It.FattureInCloud.Sdk.Test/Api/SettingsApiTests.cs b/src/It.FattureInCloud.Sdk.Test/Api/SettingsApiTests.cs index 2ff82a88..ed87bed3 100644 --- a/src/It.FattureInCloud.Sdk.Test/Api/SettingsApiTests.cs +++ b/src/It.FattureInCloud.Sdk.Test/Api/SettingsApiTests.cs @@ -41,6 +41,8 @@ public class SettingsApiTests : IDisposable string createPaymentMethodResponseBody; string getPaymentMethodResponseBody; string modifyPaymentMethodResponseBody; + string getTaxProfileResponseBody; + public SettingsApiTests() { @@ -79,6 +81,11 @@ public SettingsApiTests() instance .Setup(p => p.ModifyPaymentMethod(Moq.It.IsAny(), Moq.It.IsAny(), Moq.It.IsAny(), 0)) .Returns(modifyPaymentMethodResponse); + getTaxProfileResponseBody = "{ 'data': { 'company_type': 'individual', 'company_subtype': 'artigiani', 'profession': 'test', 'regime': 'forfettario_5', 'rivalsa_name': '', 'default_rivalsa': 0.0, 'cassa_name': '', 'default_cassa': 0.0, 'default_cassa_taxable': 100.0, 'cassa2_name': '', 'default_cassa2': 0.0, 'default_cassa2_taxable': 0.0, 'default_withholding_tax': 0.0, 'default_withholding_tax_taxable': 100.0, 'default_other_withholding_tax': 0.0, 'enasarco': false, 'enasarco_type': 'null', 'contributions_percentage': 0.0, 'med': false, 'default_vat': { 'id': 66, 'value': 0.0, 'description': 'Contribuenti forfettari', 'notes': 'Operazione non soggetta a IVA ai sensi dell\"art. 1, commi 54-89, Legge n. 190\\/2014 e succ. modifiche\\/integrazioni', 'e_invoice': true, 'ei_type': '2.2', 'ei_description': 'Non soggetta art. 1/54-89 L. 190/2014 e succ. modifiche/integrazioni', 'is_disabled': false, 'default': true } } }"; + var getTaxProfileResponse = JsonConvert.DeserializeObject(getTaxProfileResponseBody); + instance + .Setup(p => p.GetTaxProfile(2,0)) + .Returns(getTaxProfileResponse); } public void Dispose() @@ -208,5 +215,20 @@ public void ModifyPaymentMethodTest() Assert.True(JToken.DeepEquals(obj, JObject.FromObject(response))); } + + /// + /// Test getTaxProfile + /// + [Fact] + public void getTaxProfileTest() + { + int companyId = 2; + + var response = instance.Object.GetTaxProfile(companyId, 0); + JObject obj = JObject.Parse(getTaxProfileResponseBody); + Console.WriteLine(obj); + Console.WriteLine(JObject.FromObject(response)); + Assert.True(JToken.DeepEquals(obj, JObject.FromObject(response))); + } } } diff --git a/src/It.FattureInCloud.Sdk.Test/Model/GetTaxProfileResponseTests.cs b/src/It.FattureInCloud.Sdk.Test/Model/GetTaxProfileResponseTests.cs index e8d48fde..7c79d418 100644 --- a/src/It.FattureInCloud.Sdk.Test/Model/GetTaxProfileResponseTests.cs +++ b/src/It.FattureInCloud.Sdk.Test/Model/GetTaxProfileResponseTests.cs @@ -32,12 +32,13 @@ namespace It.FattureInCloud.Sdk.Test.Model public class GetTaxProfileResponseTests : IDisposable { // TODO uncomment below to declare an instance variable for GetTaxProfileResponse - //private GetTaxProfileResponse instance; + private GetTaxProfileResponse instance; public GetTaxProfileResponseTests() { // TODO uncomment below to create an instance of GetTaxProfileResponse - //instance = new GetTaxProfileResponse(); + var body = "{ 'data': { 'company_type': 'individual', 'company_subtype': 'artigiani', 'profession': 'test', 'regime': 'forfettario_5', 'rivalsa_name': '', 'default_rivalsa': 0, 'cassa_name': '', 'default_cassa': 0, 'default_cassa_taxable': 100, 'cassa2_name': '', 'default_cassa2': 0, 'default_cassa2_taxable': 0, 'default_withholding_tax': 0, 'default_withholding_tax_taxable': 100, 'default_other_withholding_tax': 0, 'enasarco': false, 'enasarco_type': 'null', 'contributions_percentage': 0, 'med': false, 'default_vat': { 'id': 66, 'value': 0, 'description': 'Contribuenti forfettari', 'notes': 'Operazione non soggetta a IVA ai sensi dell\"art. 1, commi 54-89, Legge n. 190\\/2014 e succ. modifiche\\/integrazioni', 'e_invoice': true, 'ei_type': '2.2', 'ei_description': 'Non soggetta art. 1/54-89 L. 190/2014 e succ. modifiche/integrazioni', 'editable': false, 'is_disabled': false, 'default': true } } }"; + instance = JsonConvert.DeserializeObject(body); } public void Dispose() @@ -51,8 +52,7 @@ public void Dispose() [Fact] public void GetTaxProfileResponseInstanceTest() { - // TODO uncomment below to test "IsType" GetTaxProfileResponse - //Assert.IsType(instance); + Assert.IsType(instance); } /// @@ -61,7 +61,7 @@ public void GetTaxProfileResponseInstanceTest() [Fact] public void DataTest() { - // TODO unit test for the property 'Data' + Assert.IsType(instance.Data); } } } diff --git a/src/It.FattureInCloud.Sdk.Test/Model/TaxProfileTests.cs b/src/It.FattureInCloud.Sdk.Test/Model/TaxProfileTests.cs index f0681890..ffab9e7c 100644 --- a/src/It.FattureInCloud.Sdk.Test/Model/TaxProfileTests.cs +++ b/src/It.FattureInCloud.Sdk.Test/Model/TaxProfileTests.cs @@ -31,13 +31,12 @@ namespace It.FattureInCloud.Sdk.Test.Model /// public class TaxProfileTests : IDisposable { - // TODO uncomment below to declare an instance variable for TaxProfile - //private TaxProfile instance; + private TaxProfile instance; public TaxProfileTests() { - // TODO uncomment below to create an instance of TaxProfile - //instance = new TaxProfile(); + var body = "{ 'company_type': 'individual', 'company_subtype': 'artigiani', 'profession': 'test', 'regime': 'forfettario_5', 'rivalsa_name': '', 'default_rivalsa': 0, 'cassa_name': '', 'default_cassa': 0, 'default_cassa_taxable': 100, 'cassa2_name': '', 'default_cassa2': 0, 'default_cassa2_taxable': 0, 'default_withholding_tax': 0, 'default_withholding_tax_taxable': 100, 'default_other_withholding_tax': 0, 'enasarco': false, 'enasarco_type': 'null', 'contributions_percentage': 0, 'profit_coefficient': 2.2, 'med': false, 'default_vat': { 'id': 66, 'value': 0, 'description': 'Contribuenti forfettari', 'notes': 'Operazione non soggetta a IVA ai sensi dell\"art. 1, commi 54-89, Legge n. 190\\/2014 e succ. modifiche\\/integrazioni', 'e_invoice': true, 'ei_type': '2.2', 'ei_description': 'Non soggetta art. 1\\/54-89 L. 190\\/2014 e succ. modifiche\\/integrazioni', 'editable': false, 'is_disabled': false, 'default': true } }"; + instance = JsonConvert.DeserializeObject(body); } public void Dispose() @@ -51,8 +50,7 @@ public void Dispose() [Fact] public void TaxProfileInstanceTest() { - // TODO uncomment below to test "IsType" TaxProfile - //Assert.IsType(instance); + Assert.IsType(instance); } /// @@ -61,7 +59,7 @@ public void TaxProfileInstanceTest() [Fact] public void CompanyTypeTest() { - // TODO unit test for the property 'CompanyType' + Assert.IsType(instance.CompanyType); } /// @@ -70,7 +68,7 @@ public void CompanyTypeTest() [Fact] public void CompanySubtypeTest() { - // TODO unit test for the property 'CompanySubtype' + Assert.IsType(instance.CompanySubtype); } /// @@ -79,7 +77,7 @@ public void CompanySubtypeTest() [Fact] public void ProfessionTest() { - // TODO unit test for the property 'Profession' + Assert.IsType(instance.Profession); } /// @@ -88,7 +86,7 @@ public void ProfessionTest() [Fact] public void RegimeTest() { - // TODO unit test for the property 'Regime' + Assert.IsType(instance.Regime); } /// @@ -97,7 +95,7 @@ public void RegimeTest() [Fact] public void RivalsaNameTest() { - // TODO unit test for the property 'RivalsaName' + Assert.IsType(instance.RivalsaName); } /// @@ -106,7 +104,7 @@ public void RivalsaNameTest() [Fact] public void DefaultRivalsaTest() { - // TODO unit test for the property 'DefaultRivalsa' + Assert.IsType(instance.DefaultRivalsa); } /// @@ -115,7 +113,7 @@ public void DefaultRivalsaTest() [Fact] public void CassaNameTest() { - // TODO unit test for the property 'CassaName' + Assert.IsType(instance.CassaName); } /// @@ -124,7 +122,7 @@ public void CassaNameTest() [Fact] public void DefaultCassaTest() { - // TODO unit test for the property 'DefaultCassa' + Assert.IsType(instance.DefaultCassa); } /// @@ -133,7 +131,7 @@ public void DefaultCassaTest() [Fact] public void DefaultCassaTaxableTest() { - // TODO unit test for the property 'DefaultCassaTaxable' + Assert.IsType(instance.DefaultCassaTaxable); } /// @@ -142,7 +140,7 @@ public void DefaultCassaTaxableTest() [Fact] public void Cassa2NameTest() { - // TODO unit test for the property 'Cassa2Name' + Assert.IsType(instance.Cassa2Name); } /// @@ -151,7 +149,7 @@ public void Cassa2NameTest() [Fact] public void DefaultCassa2Test() { - // TODO unit test for the property 'DefaultCassa2' + Assert.IsType(instance.DefaultCassa2); } /// @@ -160,7 +158,7 @@ public void DefaultCassa2Test() [Fact] public void DefaultCassa2TaxableTest() { - // TODO unit test for the property 'DefaultCassa2Taxable' + Assert.IsType(instance.DefaultCassa2Taxable); } /// @@ -169,7 +167,7 @@ public void DefaultCassa2TaxableTest() [Fact] public void DefaultWithholdingTaxTest() { - // TODO unit test for the property 'DefaultWithholdingTax' + Assert.IsType(instance.DefaultWithholdingTax); } /// @@ -178,7 +176,7 @@ public void DefaultWithholdingTaxTest() [Fact] public void DefaultWithholdingTaxTaxableTest() { - // TODO unit test for the property 'DefaultWithholdingTaxTaxable' + Assert.IsType(instance.DefaultWithholdingTaxTaxable); } /// @@ -187,7 +185,7 @@ public void DefaultWithholdingTaxTaxableTest() [Fact] public void DefaultOtherWithholdingTaxTest() { - // TODO unit test for the property 'DefaultOtherWithholdingTax' + Assert.IsType(instance.DefaultOtherWithholdingTax); } /// @@ -196,7 +194,7 @@ public void DefaultOtherWithholdingTaxTest() [Fact] public void EnasarcoTest() { - // TODO unit test for the property 'Enasarco' + Assert.IsType(instance.Enasarco); } /// @@ -205,7 +203,7 @@ public void EnasarcoTest() [Fact] public void EnasarcoTypeTest() { - // TODO unit test for the property 'EnasarcoType' + Assert.IsType(instance.EnasarcoType); } /// @@ -214,7 +212,7 @@ public void EnasarcoTypeTest() [Fact] public void ContributionsPercentageTest() { - // TODO unit test for the property 'ContributionsPercentage' + Assert.IsType(instance.ContributionsPercentage); } /// @@ -223,7 +221,7 @@ public void ContributionsPercentageTest() [Fact] public void ProfitCoefficientTest() { - // TODO unit test for the property 'ProfitCoefficient' + Assert.IsType(instance.ProfitCoefficient); } /// @@ -232,7 +230,7 @@ public void ProfitCoefficientTest() [Fact] public void MedTest() { - // TODO unit test for the property 'Med' + Assert.IsType(instance.Med); } /// @@ -241,7 +239,7 @@ public void MedTest() [Fact] public void DefaultVatTest() { - // TODO unit test for the property 'DefaultVat' + Assert.IsType(instance.DefaultVat); } } }