/*******************************************************************************
***  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 <QObject>
using ::QObject;
// using Q_OBJECT
#include <QTest>
// using QTEST_MAIN
// using QVERIFY_EXCEPTION_THROWN
#include <qt-mocks/Matchers.h>
using qt_mocks::equals;
// using QVERIFY_FALSE
// using QVERIFY_THAT
// using QVERIFY_TRUE

#include <accounting/AccountNumber.h>
using drn::accounting::AccountNumber;
#include <foundation/Error.h>
using drn::foundation::Error;
#include <foundation/Optional.hpp>
using drn::foundation::Optional;


namespace drn
{
namespace accounting
{
namespace tests
{

struct AccountNumberUT : QObject
{
	Q_OBJECT

private slots:
	//{ constructor Tests

	void constructor_default_ShouldBeDefaults()
	{
		const AccountNumber an{};
		QVERIFY_THAT(an.integer(), equals(AccountNumber::invalid_));
	}

	void constructor_fullInit_ShouldBeValues()
	{
		const AccountNumber::ValueType expectedNumber{1001u};
		const AccountNumber an{expectedNumber};
		QVERIFY_THAT(an.integer(), equals(expectedNumber));
	}

	void constructor_invalidNumber_ShouldThrow()
	{
		QVERIFY_EXCEPTION_THROWN(AccountNumber{AccountNumber::invalid_}, Error);
	}

	//}
};

}}}

QTEST_MAIN(drn::accounting::tests::AccountNumberUT)
#include "AccountNumber-unit-tests.moc"
