public async Task ResolveBudgetAccount_WhenAccountNumberIsEmpty_ReturnsNotNull()
        {
            Controller sut = CreateSut();

            IActionResult result = await sut.ResolveBudgetAccount(_fixture.Create <int>(), string.Empty, DateTime.Today.AddDays(_random.Next(0, 7) * -1));

            Assert.That(result, Is.Not.Null);
        }
        public async Task ResolveBudgetAccount_WhenAccountNumberIsWhiteSpace_ReturnsBadRequestResult()
        {
            Controller sut = CreateSut();

            IActionResult result = await sut.ResolveBudgetAccount(_fixture.Create <int>(), " ", DateTime.Today.AddDays(_random.Next(0, 7) * -1));

            Assert.That(result, Is.TypeOf <BadRequestResult>());
        }
        public async Task ResolveBudgetAccount_WhenBudgetAccountWasReturnedFromQueryBus_ReturnsOkObjectResultWhereValueIsBudgetAccountViewModel()
        {
            Controller sut = CreateSut();

            OkObjectResult result = (OkObjectResult)await sut.ResolveBudgetAccount(_fixture.Create <int>(), _fixture.Create <string>(), DateTime.Today.AddDays(_random.Next(0, 7) * -1));

            Assert.That(result.Value, Is.TypeOf <BudgetAccountViewModel>());
        }
        public async Task ResolveBudgetAccount_WhenBudgetAccountWasReturnedFromQueryBus_ReturnsOkObjectResult()
        {
            Controller sut = CreateSut();

            IActionResult result = await sut.ResolveBudgetAccount(_fixture.Create <int>(), _fixture.Create <string>(), DateTime.Today.AddDays(_random.Next(0, 7) * -1));

            Assert.That(result, Is.TypeOf <OkObjectResult>());
        }
        public async Task ResolveBudgetAccount_WhenNoBudgetAccountWasReturnedFromQueryBus_ReturnsNotNull()
        {
            Controller sut = CreateSut(false);

            IActionResult result = await sut.ResolveBudgetAccount(_fixture.Create <int>(), _fixture.Create <string>(), DateTime.Today.AddDays(_random.Next(0, 7) * -1));

            Assert.That(result, Is.Not.Null);
        }
        public async Task ResolveBudgetAccount_WhenAccountNumberIsNotNullEmptyOrWhiteSpace_AssertQueryAsyncWasCalledOnQueryBusWithGetBudgetAccountQuery()
        {
            Controller sut = CreateSut();

            int      accountingNumber = _fixture.Create <int>();
            string   accountNumber    = _fixture.Create <string>();
            DateTime statusDate       = DateTime.Now.AddDays(_random.Next(0, 7) * -1).AddMinutes(_random.Next(-120, 120));
            await sut.ResolveBudgetAccount(accountingNumber, accountNumber, statusDate);

            _queryBusMock.Verify(m => m.QueryAsync <IGetBudgetAccountQuery, IBudgetAccount>(It.Is <IGetBudgetAccountQuery>(query => query != null && query.AccountingNumber == accountingNumber && string.CompareOrdinal(query.AccountNumber, accountNumber.ToUpper()) == 0 && query.StatusDate == statusDate.Date)), Times.Once());
        }
        public async Task ResolveBudgetAccount_WhenBudgetAccountWasReturnedFromQueryBus_ReturnsOkObjectResultWhereValueIsBudgetAccountViewModelWithAccountNumberEqualToAccountNumberOnBudgetAccountFromQueryBus()
        {
            string         accountNumber = _fixture.Create <string>();
            IBudgetAccount budgetAccount = _fixture.BuildBudgetAccountMock(accountNumber: accountNumber).Object;
            Controller     sut           = CreateSut(budgetAccount: budgetAccount);

            OkObjectResult result = (OkObjectResult)await sut.ResolveBudgetAccount(_fixture.Create <int>(), _fixture.Create <string>(), DateTime.Today.AddDays(_random.Next(0, 7) * -1));

            BudgetAccountViewModel budgetAccountViewModel = (BudgetAccountViewModel)result.Value;

            Assert.That(budgetAccountViewModel.AccountNumber, Is.EqualTo(accountNumber));
        }