26 #include <unittest-support.h>
27 #include "../gncInvoice.h"
29 static const gchar *suitename =
"/engine/gncInvoice";
30 void test_suite_gncInvoice (
void );
42 setup(
Fixture *fixture, gconstpointer pData )
47 fixture->commodity =
gnc_commodity_new(fixture->book,
"foo",
"bar",
"xy",
"xy", 100);
50 fixture->customer = gncCustomerCreate(fixture->book);
51 gncOwnerInitCustomer(&fixture->owner, fixture->customer);
55 teardown(
Fixture *fixture, gconstpointer pData )
57 gncCustomerBeginEdit(fixture->customer);
58 gncCustomerDestroy(fixture->customer);
69 test_invoice_post (
Fixture *fixture, gconstpointer pData )
71 GncInvoice *invoice = gncInvoiceCreate(fixture->book);
74 g_assert(!gncInvoiceGetIsCreditNote(invoice));
75 g_assert(gncInvoiceGetActive(invoice));
76 g_assert(gncInvoiceGetPostedAcc(invoice) == NULL);
78 gncInvoiceSetCurrency(invoice, fixture->commodity);
80 gncInvoiceSetOwner(invoice, &fixture->owner);
82 g_test_message(
"Will now post the invoice" );
83 g_assert(!gncInvoiceIsPosted(invoice));
85 g_assert(gncInvoiceIsPosted(invoice));
88 g_assert(!gncInvoiceIsPosted(invoice));
92 test_suite_gncInvoice (
void )
94 GNC_TEST_ADD( suitename,
"post",
Fixture, NULL, setup, test_invoice_post, teardown );
QofBook * qof_book_new(void)
Use a 64-bit unsigned int timespec.
void xaccAccountDestroy(Account *acc)
gnc_commodity * gnc_commodity_new(QofBook *book, const char *fullname, const char *name_space, const char *mnemonic, const char *cusip, int fraction)
Transaction * gncInvoicePostToAccount(GncInvoice *invoice, Account *acc, Timespec *post_date, Timespec *due_date, const char *memo, gboolean accumulatesplits, gboolean autopay)
gboolean gncInvoiceUnpost(GncInvoice *invoice, gboolean reset_tax_tables)
void xaccAccountBeginEdit(Account *acc)
Timespec timespec_now(void)
Account * xaccMallocAccount(QofBook *book)
void gnc_commodity_destroy(gnc_commodity *cm)
void qof_book_destroy(QofBook *book)
void xaccAccountSetCommodity(Account *acc, gnc_commodity *com)