Skip to content

Commit

Permalink
Update tests (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamelfstrom authored Oct 31, 2024
1 parent 2ea0b51 commit 7a9db15
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 13 deletions.
6 changes: 3 additions & 3 deletions FortnoxSDK.Tests/ConnectorTests/AbsenceTransactionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ namespace FortnoxSDK.Tests.ConnectorTests;
public class AbsenceTransactionTests
{
public FortnoxClient FortnoxClient = TestUtils.DefaultFortnoxClient;

[TestMethod]
public async Task Test_AbsenceTransaction_CRUD()
{
#region Arrange
var tmpEmployee = await TestUtils.GetBasicTestEmployee();
var tmpProject = await FortnoxClient.ProjectConnector.CreateAsync(new Project() { Description = "TmpProject" });
var tmpCostCenter = await FortnoxClient.CostCenterConnector.CreateAsync(new CostCenter() { Code = "TEMP", Description = "TempCostCenter" });
var tmpCostCenter = await FortnoxClient.CostCenterConnector.CreateAsync(new CostCenter() { Code = "TMPCC", Description = "TempCostCenter" });
#endregion Arrange

var connector = FortnoxClient.AbsenceTransactionConnector;
Expand Down Expand Up @@ -80,7 +80,7 @@ public async Task Test_Find()
#region Arrange
var tmpEmployee = await TestUtils.GetBasicTestEmployee();
var tmpProject = await FortnoxClient.ProjectConnector.CreateAsync(new Project() { Description = "TmpProject" });
var tmpCostCenter = await FortnoxClient.CostCenterConnector.CreateAsync(new CostCenter() { Code = "TEMP", Description = "TempCostCenter" });
var tmpCostCenter = await FortnoxClient.CostCenterConnector.CreateAsync(new CostCenter() { Code = "TMPCC", Description = "TempCostCenter" });
#endregion Arrange

var connector = FortnoxClient.AbsenceTransactionConnector;
Expand Down
4 changes: 2 additions & 2 deletions FortnoxSDK.Tests/ConnectorTests/AssetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class AssetTests
public async Task Test_Asset_CRUD()
{
#region Arrange
var tmpCostCenter = await FortnoxClient.CostCenterConnector.CreateAsync(new CostCenter() { Code = "TEMP", Description = "TempCostCenter" });
var tmpCostCenter = await FortnoxClient.CostCenterConnector.CreateAsync(new CostCenter() { Code = "TMPCC", Description = "TempCostCenter" });
var tmpAssetType = await FortnoxClient.AssetTypesConnector.CreateAsync(new AssetType() { Description = "TmpAssetType", Type = "1", Number = TestUtils.RandomString(3), AccountAssetId = 1150, AccountDepreciationId = 7824, AccountValueLossId = 1159 });
#endregion Arrange

Expand Down Expand Up @@ -82,7 +82,7 @@ await Assert.ThrowsExceptionAsync<FortnoxApiException>(
public async Task Test_Find()
{
#region Arrange
var tmpCostCenter = await FortnoxClient.CostCenterConnector.CreateAsync(new CostCenter() { Code = "TEMP", Description = "TempCostCenter" });
var tmpCostCenter = await FortnoxClient.CostCenterConnector.CreateAsync(new CostCenter() { Code = "TMPCC", Description = "TempCostCenter" });
var tmpAssetType = await FortnoxClient.AssetTypesConnector.CreateAsync(new AssetType() { Description = "TmpAssetType", Type = "1", Number = TestUtils.RandomString(3), AccountAssetId = 1150, AccountDepreciationId = 7824, AccountValueLossId = 1159 });
#endregion Arrange

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public async Task Test_AttendanceTransactions_CRUD()
#region Arrange
var tmpEmployee = await TestUtils.GetBasicTestEmployee();
var tmpProject = await FortnoxClient.ProjectConnector.CreateAsync(new Project() { Description = "TmpProject" });
var tmpCostCenter = await FortnoxClient.CostCenterConnector.CreateAsync(new CostCenter() { Code = "TEMP", Description = "TempCostCenter" });
var tmpCostCenter = await FortnoxClient.CostCenterConnector.CreateAsync(new CostCenter() { Code = "TMPCC", Description = "TempCostCenter" });
#endregion Arrange

var connector = FortnoxClient.AttendanceTransactionsConnector;
Expand All @@ -40,7 +40,7 @@ public async Task Test_AttendanceTransactions_CRUD()
Assert.AreEqual(5.5m, createdAttendanceTransaction.Hours);

#endregion CREATE

#region UPDATE

createdAttendanceTransaction.Hours = 8;
Expand Down Expand Up @@ -80,7 +80,7 @@ public async Task Test_Find()
#region Arrange
var tmpEmployee = await TestUtils.GetBasicTestEmployee();
var tmpProject = await FortnoxClient.ProjectConnector.CreateAsync(new Project() { Description = "TmpProject" });
var tmpCostCenter = await FortnoxClient.CostCenterConnector.CreateAsync(new CostCenter() { Code = "TEMP", Description = "TempCostCenter" });
var tmpCostCenter = await FortnoxClient.CostCenterConnector.CreateAsync(new CostCenter() { Code = "TMPCC", Description = "TempCostCenter" });
#endregion Arrange

var connector = FortnoxClient.AttendanceTransactionsConnector;
Expand Down
2 changes: 1 addition & 1 deletion FortnoxSDK.Tests/ConnectorTests/ContractAccrualTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace FortnoxSDK.Tests.ConnectorTests;

[Ignore("Fails with error 'Feature inte tillgänglig'")]
[Ignore("Fails with error 'Feature inte tillgänglig'")]
[TestClass]
public class ContractAccrualTests
{
Expand Down
1 change: 0 additions & 1 deletion FortnoxSDK.Tests/ConnectorTests/ContractTemplateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class ContractTemplateTests
{
public FortnoxClient FortnoxClient = TestUtils.DefaultFortnoxClient;

[Ignore("Failing on 'Internal error'. Investigation needed")]
[TestMethod]
public async Task Test_ContractTemplate_CRUD()
{
Expand Down
2 changes: 1 addition & 1 deletion FortnoxSDK.Tests/ConnectorTests/ContractTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace FortnoxSDK.Tests.ConnectorTests;

[Ignore("Failing on 'Internal error'. Investigation needed")]
[Ignore("Fails with error 'Feature inte tillgänglig'")]
[TestClass]
public class ContractTests
{
Expand Down
2 changes: 2 additions & 0 deletions FortnoxSDK.Tests/ConnectorTests/InvoiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ public async Task Test_EPrint()
#endregion Delete arranged resources
}

[Ignore("Fails with 'Bankuppgifter saknas'")]
[TestMethod]
public async Task Test_Print()
{
Expand Down Expand Up @@ -268,6 +269,7 @@ public async Task Test_Print()
#endregion Delete arranged resources
}

[Ignore("Fails with 'Bankuppgifter saknas'")]
[TestMethod]
public async Task Test_Email()
{
Expand Down
4 changes: 2 additions & 2 deletions FortnoxSDK.Tests/ConnectorTests/PrintTemplateTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task Test_Find()

var fullCollection = await connector.FindAsync(null);

Assert.AreEqual(9, fullCollection.Entities.Count);
Assert.AreEqual(8, fullCollection.Entities.Count);
Assert.IsNotNull(fullCollection.Entities.First().Name);

//Limit not supported
Expand All @@ -49,6 +49,6 @@ public async Task Test_Find_Filter()
searchSettings.FilterBy = Filter.PrintTemplate.Invoice;
var invoiceTemplates = await connector.FindAsync(searchSettings);

Assert.AreEqual(9, invoiceTemplates.Entities.Count);
Assert.AreEqual(8, invoiceTemplates.Entities.Count);
}
}

0 comments on commit 7a9db15

Please sign in to comment.