Exemplo n.º 1
0
        public void Edit_with_amount_0_or_negative_results_in_error()
        {
            var entityUnderTest             = InitializeEntityUnderTest();
            var insertJournalEntryViewModel = GetTestViewModel();

            insertJournalEntryViewModel.EntryAmount = 0;
            entityUnderTest.Edit(insertJournalEntryViewModel);
            entityUnderTest.ModelState.IsValid.Should().BeFalse();
            _journalGroupRepository.DidNotReceive().InsertDebitCreditEntries(Arg.Any <LedgerEntry>(), Arg.Any <LedgerEntry>());
        }
        public void Post_calls_with_not_existent_account_fails()
        {
            var entityUnderTest = new JournalEntriesController(_journalEntryGroupRepository, _accountRepository);
            var result          = entityUnderTest.Post(new List <JournalEntryViewModel>
            {
                new JournalEntryViewModel {
                    Account = "420000000", Credit = 1000, Remarks = "HELLO THERE"
                },
                new JournalEntryViewModel {
                    Account = "527000001", Debit = 1000, Remarks = "GENERAL KENOBI"
                }
            });

            result.Should().BeOfType <BadRequestObjectResult>();
            _journalEntryGroupRepository.DidNotReceive().InsertEntries(Arg.Any <IEnumerable <LedgerEntry> >());
        }