public void ReturnCorrectModelType_WhenGetToAll()
        {
            //Arrange
            var supplementsService    = new Mock <ISupplementsService>();
            var dropDownListPopulator = new Mock <IDropDownListPopulator>();
            var repoUser = new Mock <IEfGenericRepository <ApplicationUser> >();

            var controller = new SupplementsController(supplementsService.Object, dropDownListPopulator.Object, repoUser.Object);

            //Act & Assert
            controller.WithCallTo(c => c.Add()).ShouldRenderView("Add").WithModel <AddSupplementViewModel>();
        }
        public void RunDefaultView_WhenGetToAdd()
        {
            //Arrange
            var supplementsService    = new Mock <ISupplementsService>();
            var dropDownListPopulator = new Mock <IDropDownListPopulator>();
            var repoUser = new Mock <IEfGenericRepository <ApplicationUser> >();

            var controller = new SupplementsController(supplementsService.Object, dropDownListPopulator.Object, repoUser.Object);

            //Act & Assert
            controller.WithCallTo(c => c.Add()).ShouldRenderDefaultView();
        }
Exemple #3
0
        public void ReturnJsonResult_WhenGetToSupplementViewModels_Update()
        {
            //Arrange
            var supplementsService    = new Mock <ISupplementsService>();
            var dropDownListPopulator = new Mock <IDropDownListPopulator>();
            var repoUser            = new Mock <IEfGenericRepository <ApplicationUser> >();
            var supplementViewModel = DataHelper.GetAdminSupplementViewModel();
            var kendoDataRequest    = new DataSourceRequest();

            supplementsService.Setup(x => x.Update(It.IsAny <Supplement>())).Verifiable();

            var controller = new SupplementsController(supplementsService.Object, dropDownListPopulator.Object, repoUser.Object);

            //Act & Assert
            controller.WithCallTo(c => c.SupplementViewModels_Update(kendoDataRequest, supplementViewModel)).ShouldReturnJson();
        }
Exemple #4
0
        public void ReturnJsonResult_WhenGetToSupplementViewModels_Read()
        {
            //Arrange
            var supplementsService    = new Mock <ISupplementsService>();
            var dropDownListPopulator = new Mock <IDropDownListPopulator>();
            var repoUser         = new Mock <IEfGenericRepository <ApplicationUser> >();
            var supplements      = DataHelper.GetSupplements();
            var kendoDataRequest = new DataSourceRequest();

            supplementsService.Setup(x => x.GetAll()).Returns(supplements);

            var controller = new SupplementsController(supplementsService.Object, dropDownListPopulator.Object, repoUser.Object);

            //Act & Assert
            controller.WithCallTo(c => c.SupplementViewModels_Read(kendoDataRequest)).ShouldReturnJson();
        }