/*******************************************************************************
***  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 <QTest>

#include <map>
using std::map;
#include <string>
using namespace std::string_literals;
using std::string;

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


namespace drn
{
namespace budgeting
{
namespace tests
{

struct BillMapUT : QObject
{
	Q_OBJECT

private slots:
	// Constructor Tests

	void constructor_Empty_ShouldBeDefaults()
	{
		const BillMap bills{};
		QVERIFY2(bills.empty() == true, "By default there should not be any values.");
	}
	void constructor_FullInit_ShouldBeSupplied()
	{
		const map<BudgetSource, Bill> values{
			{
				BudgetSource{QStringLiteral("MidCo")},
				Bill{
					BudgetSource{QStringLiteral("MidCo")},
					Money{5, 34u, Iso4217Codes::USD},
					EventFrequency::Hourly,
					{9999, 6, 20}
				}
			},
			{
				BudgetSource{QStringLiteral("Xcel")},
				Bill{
					BudgetSource{QStringLiteral("Xcel")},
					Money{5, 34u, Iso4217Codes::USD},
					EventFrequency::Hourly,
					{9999, 6, 20}
				}
			}
		};
		const BillMap bills{values};
		QCOMPARE(bills.at(BudgetSource{QStringLiteral("MidCo")}), values.at(BudgetSource{QStringLiteral("MidCo")}));
		QCOMPARE(bills.at(BudgetSource{QStringLiteral("Xcel")}), values.at(BudgetSource{QStringLiteral("Xcel")}));
	}

	//}
};

}}}

QTEST_MAIN(drn::budgeting::tests::BillMapUT)
#include "BillMap-unit-tests.moc"
