Example #1
0
        public StudentApprovalListOptionsModel GenerateApprovalListOptionsViewModel()
        {
            var viewModel = new StudentApprovalListOptionsModel();

            PopulateViewModel(viewModel);
            return(viewModel);
        }
        public void GivenNoProviders_WhenGenerateApprovalListViewModel_ThenViewModelProviderFilterListIsEmpty()
        {
            var target = CreateTargetWithEmptyLookupLists();

            StudentApprovalListOptionsModel actual = target.GenerateApprovalListOptionsViewModel();

            Assert.AreEqual(0, actual.ProviderFilterList.Count());
        }
        public void GivenLogicManagerGeneratesViewModel_WhenGetManageView_ThenViewContainsViewModel()
        {
            StudentApprovalListOptionsModel expected = new StudentApprovalListOptionsModel();

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

            ViewResult actual = Target.Index();

            actual.AssertGetViewModel(expected);
        }
        public void WhenGenerateApprovalListViewModel_ThenViewModelHasCountOfStudentsWithAtLeastOneApprovedProvider()
        {
            var testData = new TestData();

            Repositories.MockProviderRepository.Expect(m => m.Items).Return(testData.Providers.AsQueryable());
            Repositories.MockStudentRepository.Expect(m => m.Items).Return(testData.Students.AsQueryable());

            StudentApprovalListOptionsModel actual = Target.GenerateApprovalListOptionsViewModel();

            Assert.AreEqual(4, actual.TotalStudentsWithApproval);
        }
        public void GivenProviders_WhenGenerateApprovalListViewModel_ThenViewModelProviderFilterListContainsProviderNames()
        {
            var expected = new List <string> {
                "Big Brothers, Big Sisters", "Jimbo's Math Shop", "YMCA"
            };
            List <Provider> providers = new TestData().Providers;

            Repositories.MockProviderRepository.Expect(m => m.Items).Return(providers.AsQueryable());
            Repositories.MockStudentRepository.Expect(m => m.Items).Return(Enumerable.Empty <Student>().AsQueryable());

            StudentApprovalListOptionsModel actual = Target.GenerateApprovalListOptionsViewModel();

            CollectionAssert.AreEqual(expected, actual.ProviderFilterList.ToList());
        }
        public void GivenStudentsWithSchools_WhenGenerateApprovalListViewModel_ThenViewModelSchoolFilterListContainsSchoolNames()
        {
            var expected = new List <string> {
                "Bombay Education Center", "Columbus High School", "Evergreen High School", "Wyoming High School"
            };
            List <Student> students = new TestData().Students;

            Repositories.MockStudentRepository.Expect(m => m.Items).Return(students.AsQueryable());
            Repositories.MockProviderRepository.Expect(m => m.Items).Return(Enumerable.Empty <Provider>().AsQueryable());

            StudentApprovalListOptionsModel actual = Target.GenerateApprovalListOptionsViewModel();

            CollectionAssert.AreEqual(expected, actual.SchoolFilterList.ToList());
        }
Example #7
0
        public ViewResult Index()
        {
            StudentApprovalListOptionsModel viewModel = LogicManager.GenerateApprovalListOptionsViewModel();

            return(View(viewModel));
        }
Example #8
0
 private void PopulateViewModel(StudentApprovalListOptionsModel viewModel)
 {
     viewModel.SchoolFilterList          = LoadSchoolNameList();
     viewModel.ProviderFilterList        = ProviderRepository.Items.Where(p => p.IsActive).Select(p => p.Name).ToList().OrderBy(p => p);
     viewModel.TotalStudentsWithApproval = CountStudentsWithApprovedProviders();
 }