Example #1
0
        public ActionResult SchoolsBySchoolType(int id)
        {
            var reportsModel = GetReportModel();

            reportsModel.SchoolTypeReport = _getSchoolsBySchoolTypeQuery.Execute(_instanceContext.Name, CloudOdsAdminAppSettings.Instance.Mode, id);

            return(PartialView("_SchoolsBySchoolType", reportsModel));
        }
        public void ShouldRetrieveSchoolCount()
        {
            var elementarySchoolCategoryDescriptorId = GetNewSchoolCategoryDescriptorId("Elementary School");
            var highSchoolCategoryDescriptorId       = GetNewSchoolCategoryDescriptorId("High School");
            var middleSchoolCategoryDescriptorId     = GetNewSchoolCategoryDescriptorId("Middle School");

            var localEducationAgencyId = GetNewLocalEducationAgencyId();
            var newHighSchoolId        = GetNewSchool(localEducationAgencyId);

            SetSchoolCategoryDescriptor(newHighSchoolId, highSchoolCategoryDescriptorId);

            var newMiddleSchoolId1 = GetNewSchool(localEducationAgencyId);
            var newMiddleSchoolId2 = GetNewSchool(localEducationAgencyId);

            SetSchoolCategoryDescriptor(newMiddleSchoolId1, middleSchoolCategoryDescriptorId);
            SetSchoolCategoryDescriptor(newMiddleSchoolId2, middleSchoolCategoryDescriptorId);

            var newElementarySchoolId1 = GetNewSchool(localEducationAgencyId);
            var newElementarySchoolId2 = GetNewSchool(localEducationAgencyId);
            var newElementarySchoolId3 = GetNewSchool(localEducationAgencyId);

            SetSchoolCategoryDescriptor(newElementarySchoolId1, elementarySchoolCategoryDescriptorId);
            SetSchoolCategoryDescriptor(newElementarySchoolId2, elementarySchoolCategoryDescriptorId);
            SetSchoolCategoryDescriptor(newElementarySchoolId3, elementarySchoolCategoryDescriptorId);

            var otherLocalAgencyId      = GetNewLocalEducationAgencyId();
            var otherHighSchoolId       = GetNewSchool(otherLocalAgencyId);
            var otherMiddleSchoolId     = GetNewSchool(otherLocalAgencyId);
            var otherElementarySchoolId = GetNewSchool(otherLocalAgencyId);

            SetSchoolCategoryDescriptor(otherHighSchoolId, highSchoolCategoryDescriptorId);
            SetSchoolCategoryDescriptor(otherMiddleSchoolId, middleSchoolCategoryDescriptorId);
            SetSchoolCategoryDescriptor(otherElementarySchoolId, elementarySchoolCategoryDescriptorId);

            var report = new GetSchoolsBySchoolTypeQuery(TestConnectionProvider);
            var result = report.Execute(CloudOdsDatabaseNames.ProductionOds, ApiMode.Sandbox, localEducationAgencyId);

            result.SchoolCounts.Count.ShouldBe(3);
            result.SchoolCounts.Single(c => c.Description == "High School").Count.ShouldBe(1);
            result.SchoolCounts.Single(c => c.Description == "Middle School").Count.ShouldBe(2);
            result.SchoolCounts.Single(c => c.Description == "Elementary School").Count.ShouldBe(3);
        }