Ejemplo n.º 1
0
        public void IndexReturnsAViewResultWithAListOfDiscount()
        {
            var mock = new Mock <IDiscountRepository>();

            mock.Setup(repo => repo.GetAll()).Returns(GetTestDiscounts());
            var controller = new DiscountController(mock.Object);


            var result = controller.Index();


            var viewResult = Xunit.Assert.IsType <ViewResult>(result);
            var model      = Xunit.Assert.IsAssignableFrom <IEnumerable <Discount> >(viewResult.Model);

            Xunit.Assert.Equal(GetTestDiscounts().Count, model.Count());
        }