public void GetAllCardBusiness()
        {
            Businessmock = Substitute.For <ICardBusiness>();
            Businessmock.GetAll().Returns(s => cardList);
            var Cards = (List <Card>)Businessmock.GetAll();

            Assert.IsTrue(Cards.Count == 1);
        }
示例#2
0
 public IEnumerable <CardDTO> Get()
 {
     return(_CardBusiness.GetAll().ToList().ConvertAll(card => new CardDTO()
     {
         CardBrand = card.CardBrand,
         CardholderName = card.CardholderName,
         CVS = card.CVS,
         CardType = card.CardType,
         CardId = card.Id,
         ExpirationDate = card.ExpirationDate,
         Number = card.Number,
         CreatedDate = card.CreatedDate
     }));
 }
        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 void GetAllCardException()
 {
     Businessmock = Substitute.For <ICardBusiness>();
     Businessmock.GetAll().Returns(s => { throw new Exception("Erro de comunicação..."); });
     Assert.ThrowsException <Exception>(() => (List <Card>)Businessmock.GetAll());
 }