-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Missing EPrint action in Invoice Connector (#301)
* Added missing EPrint action to InvoiceConnector * EPrint returns Invoices not PDF * Fix Invoice Print tests Added/updated tests had errors --------- Co-authored-by: adamelfstrom <[email protected]>
- Loading branch information
1 parent
898778e
commit 2ea0b51
Showing
4 changed files
with
52 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,13 +185,55 @@ public async Task Test_DueDate() | |
#endregion Delete arranged resources | ||
} | ||
|
||
[TestMethod] | ||
[Ignore("Fails with error 'Kan inte skicka dokument om inte företaget är registrerat'")] | ||
public async Task Test_EPrint() | ||
{ | ||
#region Arrange | ||
var cc = FortnoxClient.CustomerConnector; | ||
var ac = FortnoxClient.ArticleConnector; | ||
var tmpCustomer = await cc.CreateAsync(new Customer() { Name = "TmpCustomer", CountryCode = "SE", City = "Testopolis", Email = "[email protected]" }); | ||
var tmpArticle = await ac.CreateAsync(new Article() { Description = "TmpArticle", Type = ArticleType.Stock, PurchasePrice = 100 }); | ||
#endregion Arrange | ||
|
||
var connector = FortnoxClient.InvoiceConnector; | ||
|
||
var newInvoice = new Invoice() | ||
{ | ||
CustomerNumber = tmpCustomer.CustomerNumber, | ||
InvoiceDate = new DateTime(2019, 1, 20), //"2019-01-20", | ||
DueDate = new DateTime(2019, 2, 20), //"2019-02-20", | ||
InvoiceType = InvoiceType.CashInvoice, | ||
PaymentWay = PaymentWay.Cash, | ||
Comments = "TestInvoice", | ||
InvoiceRows = new List<InvoiceRow>() | ||
{ | ||
new InvoiceRow(){ ArticleNumber = tmpArticle.ArticleNumber, DeliveredQuantity = 10, Price = 100}, | ||
new InvoiceRow(){ ArticleNumber = tmpArticle.ArticleNumber, DeliveredQuantity = 20, Price = 100}, | ||
new InvoiceRow(){ ArticleNumber = tmpArticle.ArticleNumber, DeliveredQuantity = 15, Price = 100} | ||
} | ||
}; | ||
|
||
var createdInvoice = await connector.CreateAsync(newInvoice); | ||
|
||
var printedInvoice = await connector.EPrintAsync(createdInvoice.DocumentNumber); | ||
Assert.AreEqual(printedInvoice.DocumentNumber, createdInvoice.DocumentNumber); | ||
|
||
await connector.CancelAsync(createdInvoice.DocumentNumber); | ||
|
||
#region Delete arranged resources | ||
await FortnoxClient.CustomerConnector.DeleteAsync(tmpCustomer.CustomerNumber); | ||
// await FortnoxClient.ArticleConnector.DeleteAsync(tmpArticle.ArticleNumber); | ||
#endregion Delete arranged resources | ||
} | ||
|
||
[TestMethod] | ||
public async Task Test_Print() | ||
{ | ||
#region Arrange | ||
var cc = FortnoxClient.CustomerConnector; | ||
var ac = FortnoxClient.ArticleConnector; | ||
var tmpCustomer = await cc.CreateAsync(new Customer() { Name = "TmpCustomer", CountryCode = "SE", City = "Testopolis" }); | ||
var tmpCustomer = await cc.CreateAsync(new Customer() { Name = "TmpCustomer", CountryCode = "SE", City = "Testopolis", Email = "[email protected]" }); | ||
var tmpArticle = await ac.CreateAsync(new Article() { Description = "TmpArticle", Type = ArticleType.Stock, PurchasePrice = 100 }); | ||
#endregion Arrange | ||
|
||
|
@@ -222,7 +264,7 @@ public async Task Test_Print() | |
|
||
#region Delete arranged resources | ||
await FortnoxClient.CustomerConnector.DeleteAsync(tmpCustomer.CustomerNumber); | ||
//FortnoxClient.ArticleConnector.Delete(tmpArticle.ArticleNumber); | ||
//await FortnoxClient.ArticleConnector.DeleteAsync(tmpArticle.ArticleNumber); | ||
#endregion Delete arranged resources | ||
} | ||
|
||
|
@@ -261,7 +303,7 @@ public async Task Test_Email() | |
|
||
#region Delete arranged resources | ||
await FortnoxClient.CustomerConnector.DeleteAsync(tmpCustomer.CustomerNumber); | ||
//FortnoxClient.ArticleConnector.Delete(tmpArticle.ArticleNumber); | ||
//await FortnoxClient.ArticleConnector.DeleteAsync(tmpArticle.ArticleNumber); | ||
#endregion Delete arranged resources | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters