/*******************************************************************************
***  This file is part of Dux Rei Nummariae.                                 ***
***                                                                          ***
***  Copyright (C) 2017, 2018, 2019, 2020, 2021                              ***
***  John Schneiderman <Licensing _AT_ Schneiderman _DOT_ me>                ***
***                                                                          ***
***  This program is free software: you can redistribute it and/or modify it ***
***  under the terms of the GNU Affero General Public License as published   ***
***  by the Free Software Foundation, either version 3 of the License, or    ***
***  (at your option) any later version.                                     ***
***                                                                          ***
***  This program is distributed in the hope that it will be useful, but     ***
***  WITHOUT ANY WARRANTY; without even the implied warranty of              ***
***  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                    ***
***  See the GNU Affero General Public License for more details.             ***
***                                                                          ***
***  You should have received a copy of the GNU Affero General Public License***
***  along with this program. If not, see <http://www.gnu.org/licenses/>.    ***
*******************************************************************************/
#include <pecunia/Codes.h>
using pecunia::currency::Iso4217Codes;
#include <pecunia/Money.h>
using pecunia::currency::Money;
#include <QDate>
using ::QDate;
#include <QTest>
// using QTEST_MAIN

#include <budgeting/BudgetSource.h>
using drn::budgeting::BudgetSource;
#include <budgeting/EventFrequency.h>
using drn::budgeting::EventFrequency;
#include <budgeting/Bill.h>
using drn::budgeting::Bill;


namespace drn
{
namespace budgeting
{
namespace tests
{

struct BillUT : QObject
{
	Q_OBJECT

private slots:
	//{ Constructor Tests

	void constructor_Default_ShouldSet()
	{
		const BudgetSource source{};
		const Money amount{0, 0, Iso4217Codes::XXX};
		const EventFrequency period{EventFrequency::Unknown};
		const Bill e{};

		QCOMPARE(e.source(), source);
		QCOMPARE(e.amount(), amount);
		QCOMPARE(toWeak(e.period()), toWeak(period));
	}
	void constructor_ValidParams_ShouldSet()
	{
		const BudgetSource source{"MidCo"};
		const Money amount{200, 00, Iso4217Codes::USD};
		const EventFrequency period{EventFrequency::Monthly};
		const QDate nextOccurOn{9999, 6, 20};
		const Bill e{source, amount, period, nextOccurOn};

		QCOMPARE(e.source(), source);
		QCOMPARE(e.amount(), amount);
		QCOMPARE(toWeak(e.period()), toWeak(period));
		QCOMPARE(e.nextOccurOn(), nextOccurOn);
	}

	//}
};

}}}

QTEST_MAIN(drn::budgeting::tests::BillUT)
#include "Bill-unit-tests.moc"
