예제 #1
0
        public void ISections_AreEqual()
        {
            ISection sec1 = new Section(SectionID.FromString("1234B012"));
            ISection sec2 = new Section(SectionID.FromString("1234B012"));

            Assert.AreEqual(sec1, sec2);
        }
예제 #2
0
        public void Sections_AreNotEqual()
        {
            Section sec1 = new Section(SectionID.FromString("1234B012"));
            Section sec2 = new Section(SectionID.FromString("4321B121"));

            Assert.AreNotEqual(sec1, sec2);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="queryString"></param>
        /// <param name="count"></param>
        /// <returns></returns>
        public IList <ISectionID> GetSectionIDListFromQuery(string queryString, int count)
        {
            IList <ISectionID> ids = new List <ISectionID>(count);

            string sql = string.Format("select top {0} ClassID from vw_Class where CourseTitle like '%{1}%' {2} {3}", count, queryString, _yrqFilter, _sectionFilter);

            try
            {
                if (_conn.State != ConnectionState.Open)
                {
                    _conn.Open();
                }

                using (DbCommand cmd = _conn.CreateCommand())
                {
                    cmd.CommandText = sql;

                    cmd.ExecuteScalar().ToString();
                    using (DbDataReader rs = cmd.ExecuteReader())
                    {
                        while (rs.Read())
                        {
                            ids.Add(SectionID.FromString(rs["ClassID"].ToString().Trim()));
                        }
                    }

                    return(ids);
                }
            }
            catch (SqlException ex)
            {
                throw new DataException(String.Format("An error occurred while attempting execute the following SQL: \"{0}\"", sql), ex);
            }
        }
예제 #4
0
        public void ISectionToString_Success()
        {
            string   sectionIdString = "1234B012";
            ISection section         = new Section(SectionID.FromString(sectionIdString));

            Assert.AreEqual(sectionIdString, section.ToString());
        }
예제 #5
0
        public void AreNotEqual()
        {
            ISectionID expected = SectionID.FromString("1234B012");
            ISectionID actual   = SectionID.FromString("4321A121");

            Assert.AreNotEqual(expected, actual);
        }
예제 #6
0
        public void AreEqual_String()
        {
            string     sectionIdString = "1234B012";
            ISectionID actual          = SectionID.FromString(sectionIdString);

            Assert.AreEqual(actual, sectionIdString);
        }
예제 #7
0
        public void SectionIdToString_Success()
        {
            string     expected = "1234B012";
            ISectionID actual   = SectionID.FromString(expected);

            Assert.AreEqual(expected, actual.ToString());
        }
예제 #8
0
        public void AreEqual()
        {
            string     sectionIdString = "1234B012";
            ISectionID expected        = SectionID.FromString(sectionIdString);
            ISectionID actual          = SectionID.FromString(sectionIdString);

            Assert.AreEqual(expected, actual);
        }
예제 #9
0
        public void FromString_Success_ItemNumberWithLeadingZeroes()
        {
            string     itemNumber = "0002";
            string     yrq        = "B012";
            ISectionID id         = SectionID.FromString(String.Concat(itemNumber, yrq));

            Assert.AreEqual(id.ItemNumber, itemNumber);
            Assert.AreEqual(id.YearQuarter, yrq);
        }
예제 #10
0
        [Ignore] // this cast doesn't seem to work. Would like to make it work somehow. [email protected] 3/14/2013
        public void SubClassed_SafeCast()
        {
            string     sectionId = "4321A121";
            ISectionID actual    = SectionID.FromString(sectionId);

            SubclassedSectionID subclassed = actual as SubclassedSectionID;

            Assert.IsNotNull(subclassed);
        }
예제 #11
0
        public void ID_ToString()
        {
            string     sectionId = "4321A121";
            ISectionID actual    = SectionID.FromString(sectionId);

            string actualString = actual.ToString();

            Assert.AreEqual(sectionId, actualString);
        }
예제 #12
0
        public void SubClassed_NewFromISectionID()
        {
            string     sectionId = "4321A121";
            ISectionID actual    = SectionID.FromString(sectionId);

            SubclassedSectionID subclassed = new SubclassedSectionID(actual);

            Assert.IsNotNull(subclassed);
            Assert.AreEqual(sectionId, subclassed.ToString());
        }
예제 #13
0
 public void ISectionInstantiation_Success()
 {
     ISection section = new Section(SectionID.FromString("1234B012"));
 }
예제 #14
0
        public void FromString_StringTooLong()
        {
            SectionID.FromString("12345B012");

            Assert.Fail("Should have thrown a FormatException");
        }
예제 #15
0
        public void FromString_EmptyString()
        {
            SectionID.FromString(String.Empty);

            Assert.Fail("Should have thrown a FormatException");
        }
예제 #16
0
        public void AreNotEqual_String()
        {
            ISectionID actual = SectionID.FromString("4321A121");

            Assert.AreNotEqual("1234B012", actual);
        }