public CardBusinessTest() { cardList = new List <Card>(); var CardId = Guid.NewGuid(); Card card = new Card() { Id = CardId, CardBrand = "VISA", CardType = 1, Number = "4539204051740520" }; cardList.Add(card); #region Business Businessmock = Substitute.For <ICardBusiness>(); Businessmock.SaveAndUpdate(card); Businessmock.Get(Guid.NewGuid()).Returns((Card)null); #endregion }
public void CardControllerPostTest() { var CardId = Guid.NewGuid(); ICardBusiness _service = Substitute.For <ICardBusiness>(); _service.SaveAndUpdate(new Card() { Id = CardId, CardBrand = "VISA", CardType = 1, Number = "4539204051740520" }); _service.Get(CardId).Returns(s => new Card() { Id = CardId, CardBrand = "VISA", CardType = 1, Number = "4539204051740520" }); _controller = new CardController(_service); _controller.Post(new CardDTO() { CardId = CardId, CardBrand = "VISA", CardType = 1, Number = "4539204051740520" }); var card = _service.Get(CardId); Assert.IsNotNull(card); }
public PaymentController(IWalletUserBusiness payment, IMobileTopUpPaymentBusiness mtp, IMobilePaymentBusiness mpaymentPP, ITransactionLimitBusiness tbuss, ICardBusiness card) { _payment = payment; _mtp = mtp; _mpaymentPP = mpaymentPP; _transactionLimit = tbuss; _card = card; }
public void GetAllCardBusiness() { Businessmock = Substitute.For <ICardBusiness>(); Businessmock.GetAll().Returns(s => cardList); var Cards = (List <Card>)Businessmock.GetAll(); Assert.IsTrue(Cards.Count == 1); }
public CardController( ICardBusiness cardBusiness, IMapper mapper, IApiResponseWrapper apiResponseWrapper) { this.cardBusiness = cardBusiness; this.mapper = mapper; this.apiResponseWrapper = apiResponseWrapper; }
public void GetCardBusinessNotNull() { Businessmock = Substitute.For <ICardBusiness>(); var cardactioId = Guid.NewGuid(); Businessmock.Get(cardactioId).Returns(s => new Card() { Id = Guid.NewGuid(), CardBrand = "VISA", CardType = 1, Number = "4539204051740520" }); var card = Businessmock.Get(cardactioId); Assert.IsNotNull(card); }
public void CardControllerGetAllTest() { ICardBusiness _service = Substitute.For <ICardBusiness>(); _service.GetAll().Returns(s => new List <Card>() { new Card() { Id = Guid.NewGuid(), CardBrand = "VISA", CardType = 1, Number = "4539204051740520" } }); _controller = new CardController(_service); var listCards = (List <CardDTO>)_controller.Get(); Assert.IsTrue(listCards.Count == 1); }
public CardController(ICardBusiness cardBusiness) { _cardBusiness = cardBusiness; }
public CardController(ICardBusiness cardBusiness, IWalletUserBusiness walletUser) { _card = cardBusiness; _walletUserBusiness = walletUser; }
public CardController(AppDbContext db, IMapper mapper, ICardBusiness cardBusiness) { this._context = db; this._mapper = mapper; this._cardBusiness = cardBusiness; }
public CardController(ICardBusiness CardBusiness) { _CardBusiness = CardBusiness; }
public void GetAllCardException() { Businessmock = Substitute.For <ICardBusiness>(); Businessmock.GetAll().Returns(s => { throw new Exception("Erro de comunicação..."); }); Assert.ThrowsException <Exception>(() => (List <Card>)Businessmock.GetAll()); }