Exemple #1
0
        public async Task AllApiActionShouldReturnCorrectActionResult()
        {
            var mockRepo = new Mock <IRepository <Customers> >();

            mockRepo.Setup(repo => repo.All())
            .Returns(GetTestCustomers());
            var controller = new CustomersController(mockRepo.Object);

            var result = await controller.All();

            Assert.IsType <JsonResult>(result);
        }
Exemple #2
0
        public async Task AllApiActionShouldReturnActionResultWithCorrectType()
        {
            var mockRepo = new Mock <IRepository <Customers> >();

            mockRepo.Setup(repo => repo.All())
            .Returns(GetTestCustomers());
            var controller = new CustomersController(mockRepo.Object);

            var result = await controller.All();

            var jsonResult = Assert.IsType <JsonResult>(result);

            Assert.IsAssignableFrom <IEnumerable <CustomerBindingModel> >(
                jsonResult.Value);
        }