Beispiel #1
0
        public void ReturnJsonResultWithCorrectModelInstance_WhenGetToBrands_Read()
        {
            //Arrange
            var brandsService    = new Mock <IBrandsService>();
            var brands           = DataHelper.GetBrands();
            var kendoDataRequest = new DataSourceRequest();

            brandsService.Setup(x => x.GetAll()).Returns(brands);

            var controller = new BrandsController(brandsService.Object);

            //Act
            var     controllerResult = controller.Brands_Read(kendoDataRequest);
            var     jsonResult       = controllerResult as JsonResult;
            dynamic kendoResultData  = jsonResult.Data;
            var     results          = kendoResultData.Data as IEnumerable <BrandViewModel>;

            //Assert
            Assert.IsInstanceOf <IList <BrandViewModel> >(results);
        }