This repository was archived by the owner on Apr 12, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +36
-1
lines changed
Xero.Api/Core/Model/Types Expand file tree Collapse file tree 3 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,12 @@ public void can_get_credit_note_as_pdf()
2020 AssertOk ( PdfEndpointType . CreditNotes , new CreditNotes . Create ( ) . Given_a_creditnote ( ) . Id ) ;
2121 }
2222
23+ [ Test ]
24+ public void can_get_purchase_order_as_pdf ( )
25+ {
26+ AssertOk ( PdfEndpointType . PurchaseOrders , new PurchaseOrders . Create ( ) . Given_a_purchase_order ( ) . Id ) ;
27+ }
28+
2329 [ Test ]
2430 public void invoice_gives_404_when_not_found ( )
2531 {
@@ -32,6 +38,12 @@ public void credit_note_gives_404_when_not_found()
3238 Assert . Throws < NotFoundException > ( ( ) => Api . PdfFiles . Get ( PdfEndpointType . CreditNotes , Guid . NewGuid ( ) ) ) ;
3339 }
3440
41+ [ Test ]
42+ public void purchase_order_gives_404_when_not_found ( )
43+ {
44+ Assert . Throws < NotFoundException > ( ( ) => Api . PdfFiles . Get ( PdfEndpointType . PurchaseOrders , Guid . NewGuid ( ) ) ) ;
45+ }
46+
3547 private void AssertOk ( PdfEndpointType type , Guid id )
3648 {
3749 var pdf = Api . PdfFiles . Get ( type , id ) ;
Original file line number Diff line number Diff line change @@ -58,5 +58,27 @@ private Guid ContactId
5858 return Api . Contacts . Find ( ) . First ( ) . Id ;
5959 }
6060 }
61+
62+ public PurchaseOrder Given_a_purchase_order ( )
63+ {
64+ return Api . PurchaseOrders . Create (
65+ new PurchaseOrder
66+ {
67+ Status = PurchaseOrderStatus . Authorised ,
68+ Date = DateTime . Today ,
69+ Contact = new Contact { Id = ContactId } ,
70+ LineItems = new List < LineItem > ( )
71+ {
72+ new LineItem
73+ {
74+ Description = "An item I want to purchase" ,
75+ UnitAmount = 1 ,
76+ Quantity = 1 ,
77+
78+ }
79+ }
80+ }
81+ ) ;
82+ }
6183 }
6284}
Original file line number Diff line number Diff line change 33 public enum PdfEndpointType
44 {
55 CreditNotes ,
6- Invoices
6+ Invoices ,
7+ PurchaseOrders
78 }
89}
You can’t perform that action at this time.
0 commit comments