Exemplo n.º 1
0
        public void YearQuarter_FromString_Success()
        {
            string      expected = "B014";
            YearQuarter yrq      = YearQuarter.FromString(expected);

            Assert.AreEqual(expected, yrq.ToString());
        }
Exemplo n.º 2
0
        public void YearQuarter_FriendlyName_Success()
        {
            string      expected = "Spring 2011";
            YearQuarter yrq      = YearQuarter.FromString("B014");

            Assert.AreEqual(expected, yrq.FriendlyName);
        }
Exemplo n.º 3
0
        public void GetSections_Fall2011_OnCampus_WideTimeRange()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                TimeSpan startTime = new TimeSpan(2, 55, 0);
                TimeSpan endTime   = new TimeSpan(22, 55, 0);

                IList <ISectionFacet> facets = new List <ISectionFacet>();
                facets.Add(new TimeFacet(startTime, endTime));
                facets.Add(new ModalityFacet(ModalityFacet.Options.OnCampus));
                facets.Add(new AvailabilityFacet(AvailabilityFacet.Options.All));

                string subject = null;

//				IList<Section> sections = repository.GetSections(subject, YearQuarter.FromString("B122"), facets);
                IList <Section> sections = repository.GetSections(YearQuarter.FromString("B122"), facets);
                Assert.IsTrue(sections.Count > 0, "No sections were returned");

                // make sure we have sections that fall in the specified range...
                int rightSectionCount = sections.Where(s => s.Offered.Where(o => (o.StartTime.HasValue && o.StartTime.Value.TimeOfDay.CompareTo(startTime) >= 0 && o.StartTime.Value.TimeOfDay.CompareTo(endTime) <= 0)).Count() > 0).Count();
                Assert.IsTrue(rightSectionCount > 0, "Section records do not include start/end times in the specified range.");

                // ... and that we don't have any that fall outside that range
                int wrongSectionCount = sections.Where(s => s.Offered.Where(o => (o.StartTime.HasValue && o.StartTime.Value.TimeOfDay.CompareTo(startTime) < 0 && o.StartTime.Value.TimeOfDay.CompareTo(endTime) > 0)).Count() > 0).Count();
                Assert.IsTrue(wrongSectionCount <= 0, "Found {0} sections with start/end times outside of {1} - {2}", wrongSectionCount, startTime, endTime);
            }
        }
Exemplo n.º 4
0
        public void YearQuarter_Equals_AnotherCreatedFromFriendlyName()
        {
            YearQuarter yrq1 = YearQuarter.FromString("B121");
            YearQuarter yrq2 = YearQuarter.FromFriendlyName("Summer 2011");

            Assert.AreEqual(yrq1, yrq2);
        }
Exemplo n.º 5
0
        public void YearQuarter_Equals_Another()
        {
            YearQuarter yrq1 = YearQuarter.FromString("B121");
            YearQuarter yrq2 = YearQuarter.FromString("B121");

            Assert.AreEqual(yrq1, yrq2);
        }
Exemplo n.º 6
0
        public void YearQuarter_Max()
        {
            string      yrqMin = TestHelper.MaxYrq;
            YearQuarter yrq    = YearQuarter.FromString(yrqMin);

            Assert.AreEqual(yrqMin, yrq.ID);
            Assert.AreEqual("[Maximum]", yrq.FriendlyName);
        }
        public void GetSectionsByCourseID_WithYrq_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter     yrq      = YearQuarter.FromString("B012");
                IList <Section> sections = repository.GetSections(CourseID.FromString("ART 101"), yrq);

                Assert.IsTrue(sections.Count > 0);
            }
        }
        public void GetSections_VerifyCommonCourseCharacterRemovedFromCourseID()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections = repository.GetSections("ENGL", YearQuarter.FromString("B122"));

                int count = sections.Where(s => s.CourseID.Contains("&")).Count();
                Assert.IsTrue(count == 0, "{0} records found to still contain the CCN character ('&') in the CourseID", count);
            }
        }
        public void GetSectionsBySubject_WithQuarterFilter_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter     yrq      = YearQuarter.FromString("B122");
                IList <Section> sections = repository.GetSections("ENGL", yrq);
                int             count    = sections.Where(s => s.Yrq.ID == "B122" && s.CourseID.StartsWith("ENGL")).Count();

                Assert.AreEqual(sections.Count, count);
            }
        }
        public void GetSectionsByYearQuarter_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                string      yearQuarterId = "B012";
                YearQuarter yrq           = YearQuarter.FromString(yearQuarterId);

                IList <Section> sections = repository.GetSections(yrq);
                int             count    = sections.Where(s => s.Yrq.ID == yearQuarterId).Count();

                Assert.AreEqual(sections.Count, count);
            }
        }
//		[Conditional("BC_ONLY")]
        public void GetSectionsByCourseID_WithYrq_VerifyInstructorEmail()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter yrq      = YearQuarter.FromString("B233");
                string      courseId = "ART 101";

                IList <Section> sections = repository.GetSections(CourseID.FromString(courseId), yrq, TestHelper.GetFacets());
                Assert.IsTrue(sections.Count > 0, "No sections found for {0} in {1}", courseId, yrq.FriendlyName);

                int emailCount = sections.Where(s => s.Offered.Where(o => !string.IsNullOrWhiteSpace(o.InstructorEmail)).Count() > 0).Count();
                Assert.IsTrue(emailCount > 0, "No instructor e-mails found.");
            }
        }
        public void GetSectionsBySubject_WithQuarterFilter_OnCampus_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                YearQuarter           yrq    = YearQuarter.FromString("B122");
                IList <ISectionFacet> facets = new List <ISectionFacet>(1);
                facets.Add(new ModalityFacet(ModalityFacet.Options.OnCampus));

                IList <Section> sections = repository.GetSections("ART", yrq, facets);
                Assert.IsTrue(sections.Count > 0, "No records found.");

                int count = sections.Where(s => s.Yrq.ID == yrq.ID && s.CourseID.StartsWith("ART")).Count();
                Assert.AreEqual(sections.Count, count);
            }
        }
        public void GetSections_ThreeQuarters_Success()
        {
            IList <YearQuarter> yearQuartersToFilter = new List <YearQuarter>();

            yearQuartersToFilter.Add(YearQuarter.FromString("B014"));
            yearQuartersToFilter.Add(YearQuarter.FromString("B121"));
            yearQuartersToFilter.Add(YearQuarter.FromString("B122"));

            int returnedCount = TestHelper.GetSectionCountWithFilter(new YearQuarterFacet(yearQuartersToFilter), false);
            int actualCount   = _dataVerifier.GetSectionCount(string.Format("YearQuarterID in ('{0}', '{1}', '{2}')",
                                                                            yearQuartersToFilter[0].ID,
                                                                            yearQuartersToFilter[1].ID,
                                                                            yearQuartersToFilter[2].ID));

            Assert.AreEqual(actualCount, returnedCount);
        }
        public void GetSections_VerifySortedByCourseID()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <Section> sections     = repository.GetSections("ENGL", YearQuarter.FromString("B122"));
                string          prevCourseID = "    ";

                // TODO: is there a more efficient way to determine that the whole list is sorted?
                foreach (ISection section in sections)
                {
                    string thisCourseID = section.CourseID;
                    Assert.IsTrue(thisCourseID.CompareTo(prevCourseID) >= 0, "Invalid order found: [{0}] is not less than [{1}]", prevCourseID, thisCourseID);

                    prevCourseID = thisCourseID;
                }
            }
        }
Exemplo n.º 15
0
        public void RetrievingPresentAndFutureDescriptions()
        {
            using (OdsRepository ods = new OdsRepository())
            {
                ICourseID courseID = CourseID.FromString("ECON&201");
                IList <CourseDescription> descs = ods.GetCourseDescription(courseID, YearQuarter.FromString("B234"));

                Assert.IsNotNull(descs);

                foreach (CourseDescription desc in descs)
                {
                    Console.Out.WriteLine("[{0}] {1}", desc.YearQuarterBegin, desc.Description);
                }

                Assert.IsTrue(descs.Count > 1, "ECON& 201 should have 2 descriptions, but only has {0}", descs.Count);
            }
        }
        public void GetSubjectsWithYrq_Modality_Online_Success()
        {
            using (OdsRepository repo = new OdsRepository())
            {
                YearQuarter           yearQuarter = YearQuarter.FromString("B122");
                IList <ISectionFacet> facets      = new List <ISectionFacet>();

                facets.Add(new ModalityFacet(ModalityFacet.Options.Online));
                IList <CoursePrefix> actual = repo.GetCourseSubjects(yearQuarter, facets);

                int expectedCount = _dataVerifier.GetCourseSubjectCountForSections(string.Format("YearQuarterID = '{0}' and SBCTCMisc1 like '3%'", yearQuarter.ID), true);
                Assert.AreEqual(expectedCount, actual.Count);

                int allCount = _dataVerifier.GetCourseSubjectCountForSections(string.Format("YearQuarterID = '{0}'", yearQuarter.ID));
                Assert.IsTrue(allCount > actual.Count, "Count of online sections is not less than all sections");
            }
        }
        public void GetSectionsBySubjectList_Success()
        {
            using (OdsRepository repository = new OdsRepository())
            {
                IList <ISectionFacet> facets = TestHelper.GetFacets();

                IList <string> subjects = new List <string>(2)
                {
                    "ENGL", "ENGL&"
                };

                YearQuarter     yrq      = YearQuarter.FromString("B122");
                IList <Section> sections = repository.GetSections(subjects, yrq);
                int             count    = sections.Where(s => s.CourseSubject == "ENGL").Count();

                Assert.AreEqual(sections.Count, count);
            }
        }
        public void GetSections_Verify_IsVariableCredits_Flag()
        {
            IList <Section> sections = TestHelper.GetSectionsWithFilter(new YearQuarterFacet(YearQuarter.FromString("B123")), false);
//          IList<Section> engl = sections.Where(s => s.CourseSubject.ToUpper() == "ENGL" && s.CourseNumber == "299").ToList();

            int actual = sections.Where(s => s.IsVariableCredits).Count();

            int expected = _dataVerifier.GetSectionCount("isnull(VariableCredits, 0) <> 0 and YearQuarterID = 'B123'");

            Assert.AreEqual(expected, actual);
        }