public void TransactionControllerPostTest() { var TransactionId = Guid.NewGuid(); ITransactionBusiness _service = Substitute.For <ITransactionBusiness>(); _service.SaveAndUpdate(new Transaction() { Id = Guid.NewGuid(), Amount = 100.00M, Number = 12, Active = true, Card = new Card() { Id = Guid.NewGuid(), CardBrand = "VISA", CardType = 1, Number = "4539204051740520", CardholderName = "USUARIO DE TESTE" } }); _service.Get(TransactionId).Returns(s => new Transaction() { Id = Guid.NewGuid(), Amount = 100.00M, Number = 12, Active = true, Card = new Card() { Id = Guid.NewGuid(), CardBrand = "VISA", CardType = 1, Number = "4539204051740520", CardholderName = "USUARIO DE TESTE" } }); _controller = new TransactionController(_service); _controller.Post(new TransactionDTO() { TransactionId = Guid.NewGuid(), Amount = 100.00M, Number = 12, CardId = Guid.NewGuid().ToString(), CardBrand = "VISA", CardType = 1, CardNumber = "4539204051740520", CardholderName = "USUARIO DE TESTE" }); var card = _service.Get(TransactionId); Assert.IsNotNull(card); }
public async Task<ActionResult> Detail(int id = 0) { var transaction = await _ITransactionBussiness.Get(id); try { if (transaction.SenderId == 1) { transaction.SenderName = "System"; } else { var wallet = _IWalletBusiness.Get(transaction.SenderId); transaction.SenderName = wallet.Name; transaction.Wallet = wallet; } } catch { } try { var wallet = _IWalletBusiness.Get(transaction.ReceiverId); transaction.ReceiverName = wallet.Name; transaction.Wallet = wallet; } catch { } return View(transaction); }
public TransactionBusinessTest() { transList = new List <Transaction>(); var CardId = Guid.NewGuid(); var TransactionId = Guid.NewGuid(); Transaction trans = new Transaction() { Id = TransactionId, Active = true, Card = new Card() { Id = CardId, CardBrand = "VISA", CardType = 1, Number = "4539204051740520" } }; transList.Add(trans); #region Business Businessmock = Substitute.For <ITransactionBusiness>(); Businessmock.SaveAndUpdate(trans); Businessmock.Get(Guid.NewGuid()).Returns((Transaction)null); #endregion }
public void GetTransactionBusinessNotNull() { Businessmock = Substitute.For <ITransactionBusiness>(); var transactioId = Guid.NewGuid(); Businessmock.Get(transactioId).Returns(s => new Transaction() { Id = Guid.NewGuid(), Active = true, Card = new Card() { Id = Guid.NewGuid(), CardBrand = "VISA", CardType = 1, Number = "4539204051740520" } }); var trans = Businessmock.Get(transactioId); Assert.IsNotNull(trans); }
public virtual ActionResult Search(TransactionSearchFilter filter) { ViewBag.ShowTransactionLink = true; ViewBag.AutoSubmit = false; ViewBag.BankCards = _bankCardBusiness.GetAll().Select(x => new SelectListItem { Text = x.BankName + "(" + x.AccountNumber + ")", Value = x.BankCardId.ToString() }).ToList(); var result = _transactionBusiness.Get(filter); if (!Request.IsAjaxRequest()) { return(View(result)); } return(PartialView(MVC.Transaction.Views.Partials._SearchList, result.Result)); }
public Transaction Get(string transactionId) { var id = Guid.Parse(transactionId); return(_TransactionBusiness.Get(id)); }
public void GetTransactionBusinessNull() { var trans = Businessmock.Get(Guid.NewGuid()); Assert.IsNull(trans); }