public void ShouldInitializeWithNonEmptyTransactionsCollection()
        {
            var vm = new TransactionLogViewModel();

            Assert.IsNotNull(vm.TransactionsCollection);

            CollectionAssert.AllItemsAreInstancesOfType(vm.TransactionsCollection, typeof(Transaction));
            CollectionAssert.AllItemsAreNotNull(vm.TransactionsCollection);
            CollectionAssert.AllItemsAreUnique(vm.TransactionsCollection);
        }
Beispiel #2
0
        public TransactionLogViewModel GetTransactionLogViewModel(int fileId)
        {
            try
            {
                var viewModel = new TransactionLogViewModel
                {
                    FileName            = _baseRepo.GetFileNameById(fileId),
                    ProcessedLineCount  = _baseRepo.GetProcessedLineCountForFile(fileId),
                    ProcessedTaxDetails = null, //_baseRepo.GetProcessedTaxDetailsByFileId(fileId),
                    UnprocessedDetails  = _baseRepo.GetUnprocessedDetailsByFileId(fileId)
                };

                return(viewModel);
            }
            catch (Exception ex)
            {
                _logger.LogException(ex, null);
                return(null);
            }
        }
        // Ação de detalhes de um cliente específico
        public ActionResult Detail(int transactionLogId)
        {
            var transactionLogViewModel = new TransactionLogViewModel();
            //Buscar pelo registro no log de transações cujo Id tenha sido fornecido como parâmetro
            var transactionLog = _unitOfWork.TransactionLogs.SingleOrDefault(t => t.Id == transactionLogId);

            //Caso não encontre o cliente específico retorna Not Found
            if (transactionLog == null)
            {
                return(HttpNotFound());
            }

            transactionLogViewModel.TransactionLog = transactionLog;

            var errorLog = _unitOfWork.ErrorLogs.GetAllErrorsFromTransactionLog(transactionLogId);

            transactionLogViewModel.ErrorsLog = errorLog;

            //Retorna o cliente específico para a view Details(detalhes do cliente)
            return(View(transactionLogViewModel));
        }