public async void GetCardId_CardExists_returnSuscriberWithThisCardId()
        {
            var subscriberService = new SubscriberService(
                new SubscriberRepository(
                    new WeightWatchersContext()));
            CardModel result = await subscriberService.GetByIdAsync(1);

            Assert.Equals(1, result.id);
        }
        public void GetCardId_CardExists_returnSuscriberWithThisCardId()
        {
            var mock = new Mock <ISubscriberRepository>();
            var card = new CardModel()
            {
                id = 1, weight = 200
            };

            mock.Setup(p => p.GetById(1)).Returns(card);
            SubscriberService subscriberService = new SubscriberService(mock.Object);
            var result = subscriberService.GetByIdAsync(1);

            Assert.AreEqual(card, result);
        }
Ejemplo n.º 3
0
        public async System.Threading.Tasks.Task GetCardIdAsync_CardExists_returnSuscriberWithThisCardIdAsync()
        {
            var mock = new Mock <ISubscriberRepository>();
            var card = new CardModel()
            {
                id = 1, weight = 200
            };

            mock.Setup(p => p.GetByIdAsync(1).Result).Returns(card);
            SubscriberService subscriberService = new SubscriberService(mock.Object);
            CardModel         result            = subscriberService.GetByIdAsync(1).Result;

            Assert.Equal(card, result);
        }