Skip to content

fix: added tests for taxProfile #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/It.FattureInCloud.Sdk.Test/Api/SettingsApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ public class SettingsApiTests : IDisposable
string createPaymentMethodResponseBody;
string getPaymentMethodResponseBody;
string modifyPaymentMethodResponseBody;
string getTaxProfileResponseBody;


public SettingsApiTests()
{
Expand Down Expand Up @@ -79,6 +81,11 @@ public SettingsApiTests()
instance
.Setup(p => p.ModifyPaymentMethod(Moq.It.IsAny<int>(), Moq.It.IsAny<int>(), Moq.It.IsAny<ModifyPaymentMethodRequest>(), 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<GetTaxProfileResponse>(getTaxProfileResponseBody);
instance
.Setup(p => p.GetTaxProfile(2,0))
.Returns(getTaxProfileResponse);
}

public void Dispose()
Expand Down Expand Up @@ -208,5 +215,20 @@ public void ModifyPaymentMethodTest()

Assert.True(JToken.DeepEquals(obj, JObject.FromObject(response)));
}

/// <summary>
/// Test getTaxProfile
/// </summary>
[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)));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<GetTaxProfileResponse>(body);
}

public void Dispose()
Expand All @@ -51,8 +52,7 @@ public void Dispose()
[Fact]
public void GetTaxProfileResponseInstanceTest()
{
// TODO uncomment below to test "IsType" GetTaxProfileResponse
//Assert.IsType<GetTaxProfileResponse>(instance);
Assert.IsType<GetTaxProfileResponse>(instance);
}

/// <summary>
Expand All @@ -61,7 +61,7 @@ public void GetTaxProfileResponseInstanceTest()
[Fact]
public void DataTest()
{
// TODO unit test for the property 'Data'
Assert.IsType<TaxProfile>(instance.Data);
}
}
}
59 changes: 24 additions & 35 deletions src/It.FattureInCloud.Sdk.Test/Model/TaxProfileTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@ namespace It.FattureInCloud.Sdk.Test.Model
/// </remarks>
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, '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<TaxProfile>(body);
}

public void Dispose()
Expand All @@ -51,8 +50,7 @@ public void Dispose()
[Fact]
public void TaxProfileInstanceTest()
{
// TODO uncomment below to test "IsType" TaxProfile
//Assert.IsType<TaxProfile>(instance);
Assert.IsType<TaxProfile>(instance);
}

/// <summary>
Expand All @@ -61,7 +59,7 @@ public void TaxProfileInstanceTest()
[Fact]
public void CompanyTypeTest()
{
// TODO unit test for the property 'CompanyType'
Assert.IsType<string>(instance.CompanyType);
}

/// <summary>
Expand All @@ -70,7 +68,7 @@ public void CompanyTypeTest()
[Fact]
public void CompanySubtypeTest()
{
// TODO unit test for the property 'CompanySubtype'
Assert.IsType<string>(instance.CompanySubtype);
}

/// <summary>
Expand All @@ -79,7 +77,7 @@ public void CompanySubtypeTest()
[Fact]
public void ProfessionTest()
{
// TODO unit test for the property 'Profession'
Assert.IsType<string>(instance.Profession);
}

/// <summary>
Expand All @@ -88,7 +86,7 @@ public void ProfessionTest()
[Fact]
public void RegimeTest()
{
// TODO unit test for the property 'Regime'
Assert.IsType<string>(instance.Regime);
}

/// <summary>
Expand All @@ -97,7 +95,7 @@ public void RegimeTest()
[Fact]
public void RivalsaNameTest()
{
// TODO unit test for the property 'RivalsaName'
Assert.IsType<string>(instance.RivalsaName);
}

/// <summary>
Expand All @@ -106,7 +104,7 @@ public void RivalsaNameTest()
[Fact]
public void DefaultRivalsaTest()
{
// TODO unit test for the property 'DefaultRivalsa'
Assert.IsType<decimal>(instance.DefaultRivalsa);
}

/// <summary>
Expand All @@ -115,7 +113,7 @@ public void DefaultRivalsaTest()
[Fact]
public void CassaNameTest()
{
// TODO unit test for the property 'CassaName'
Assert.IsType<string>(instance.CassaName);
}

/// <summary>
Expand All @@ -124,7 +122,7 @@ public void CassaNameTest()
[Fact]
public void DefaultCassaTest()
{
// TODO unit test for the property 'DefaultCassa'
Assert.IsType<decimal>(instance.DefaultCassa);
}

/// <summary>
Expand All @@ -133,7 +131,7 @@ public void DefaultCassaTest()
[Fact]
public void DefaultCassaTaxableTest()
{
// TODO unit test for the property 'DefaultCassaTaxable'
Assert.IsType<decimal>(instance.DefaultCassaTaxable);
}

/// <summary>
Expand All @@ -142,7 +140,7 @@ public void DefaultCassaTaxableTest()
[Fact]
public void Cassa2NameTest()
{
// TODO unit test for the property 'Cassa2Name'
Assert.IsType<string>(instance.Cassa2Name);
}

/// <summary>
Expand All @@ -151,7 +149,7 @@ public void Cassa2NameTest()
[Fact]
public void DefaultCassa2Test()
{
// TODO unit test for the property 'DefaultCassa2'
Assert.IsType<decimal>(instance.DefaultCassa2);
}

/// <summary>
Expand All @@ -160,7 +158,7 @@ public void DefaultCassa2Test()
[Fact]
public void DefaultCassa2TaxableTest()
{
// TODO unit test for the property 'DefaultCassa2Taxable'
Assert.IsType<decimal>(instance.DefaultCassa2Taxable);
}

/// <summary>
Expand All @@ -169,7 +167,7 @@ public void DefaultCassa2TaxableTest()
[Fact]
public void DefaultWithholdingTaxTest()
{
// TODO unit test for the property 'DefaultWithholdingTax'
Assert.IsType<decimal>(instance.DefaultWithholdingTax);
}

/// <summary>
Expand All @@ -178,7 +176,7 @@ public void DefaultWithholdingTaxTest()
[Fact]
public void DefaultWithholdingTaxTaxableTest()
{
// TODO unit test for the property 'DefaultWithholdingTaxTaxable'
Assert.IsType<decimal>(instance.DefaultWithholdingTaxTaxable);
}

/// <summary>
Expand All @@ -187,7 +185,7 @@ public void DefaultWithholdingTaxTaxableTest()
[Fact]
public void DefaultOtherWithholdingTaxTest()
{
// TODO unit test for the property 'DefaultOtherWithholdingTax'
Assert.IsType<decimal>(instance.DefaultOtherWithholdingTax);
}

/// <summary>
Expand All @@ -196,7 +194,7 @@ public void DefaultOtherWithholdingTaxTest()
[Fact]
public void EnasarcoTest()
{
// TODO unit test for the property 'Enasarco'
Assert.IsType<bool>(instance.Enasarco);
}

/// <summary>
Expand All @@ -205,7 +203,7 @@ public void EnasarcoTest()
[Fact]
public void EnasarcoTypeTest()
{
// TODO unit test for the property 'EnasarcoType'
Assert.IsType<string>(instance.EnasarcoType);
}

/// <summary>
Expand All @@ -214,16 +212,7 @@ public void EnasarcoTypeTest()
[Fact]
public void ContributionsPercentageTest()
{
// TODO unit test for the property 'ContributionsPercentage'
}

/// <summary>
/// Test the property 'ProfitCoefficient'
/// </summary>
[Fact]
public void ProfitCoefficientTest()
{
// TODO unit test for the property 'ProfitCoefficient'
Assert.IsType<decimal>(instance.ContributionsPercentage);
}

/// <summary>
Expand All @@ -232,7 +221,7 @@ public void ProfitCoefficientTest()
[Fact]
public void MedTest()
{
// TODO unit test for the property 'Med'
Assert.IsType<bool>(instance.Med);
}

/// <summary>
Expand All @@ -241,7 +230,7 @@ public void MedTest()
[Fact]
public void DefaultVatTest()
{
// TODO unit test for the property 'DefaultVat'
Assert.IsType<VatType>(instance.DefaultVat);
}
}
}
Loading