Example #1
0
        public RemoveApprovedProvidersBySchoolModel GenerateRemoveProvidersBySchoolViewModel()
        {
            RemoveApprovedProvidersBySchoolModel viewModel = new RemoveApprovedProvidersBySchoolModel();

            viewModel.Schools = new MultiSelectList(SchoolRepository.Items, "Id", "Name");
            return(viewModel);
        }
        public void WhenGenerateRemoveAllProvidersBySchoolViewModel_ThenViewModelSchoolListPopulated()
        {
            List <School> expectedSchools = Repositories.MockStudentRepository.Items.Select(s => s.School).Distinct().ToList();

            RemoveApprovedProvidersBySchoolModel actual = Target.GenerateRemoveProvidersBySchoolViewModel();

            CollectionAssert.AreEquivalent(expectedSchools, actual.Schools.Items.Cast <School>().ToList());
            Assert.AreEqual("Id", actual.Schools.DataValueField);
            Assert.AreEqual("Name", actual.Schools.DataTextField);
        }
        public void GivenViewModelGenerated_WhenRemoveAllProvidersBySchool_ThenViewModelContains()
        {
            RemoveApprovedProvidersBySchoolModel expected = new RemoveApprovedProvidersBySchoolModel();

            MockLogicManager.Expect(m => m.GenerateRemoveProvidersBySchoolViewModel()).Return(expected);

            PartialViewResult result = Target.RemoveAllProvidersBySchool();

            result.AssertGetViewModel(expected);
        }
        public void GivenSelectedSchoolsInViewModel_WhenRemoveAllProvidersBySchool_ThenLogicManagerInvokedWithSchoolIds()
        {
            IEnumerable <int> expected = new[] { 48, 438 };
            RemoveApprovedProvidersBySchoolModel viewModel = new RemoveApprovedProvidersBySchoolModel {
                SelectedSchools = expected
            };

            Target.RemoveAllProvidersBySchool(viewModel);

            MockLogicManager.AssertWasCalled(m => m.RemoveAllProviders(expected));
        }
        public void WhenGenerateRemoveAllProvidersBySchoolViewModel_ThenViewModelIsReturned()
        {
            RemoveApprovedProvidersBySchoolModel actual = Target.GenerateRemoveProvidersBySchoolViewModel();

            Assert.IsNotNull(actual);
        }
Example #6
0
 public ActionResult RemoveAllProvidersBySchool(RemoveApprovedProvidersBySchoolModel viewModel)
 {
     LogicManager.RemoveAllProviders(viewModel.SelectedSchools);
     return(Json(true));
 }
Example #7
0
        public PartialViewResult RemoveAllProvidersBySchool()
        {
            RemoveApprovedProvidersBySchoolModel viewModel = LogicManager.GenerateRemoveProvidersBySchoolViewModel();

            return(PartialView(viewModel));
        }