Example #1
0
        public void ReturnJsonResultWithCorrectModelInstance_WhenGetToBrands_Create()
        {
            //Arrange
            var brandsService    = new Mock <IBrandsService>();
            var brandViewModel   = DataHelper.GetAdminBrandViewModel();
            var kendoDataRequest = new DataSourceRequest();

            brandsService.Setup(x => x.Create(It.IsAny <Brand>())).Verifiable();

            var controller = new BrandsController(brandsService.Object);

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

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