public void ISections_AreEqual()
        {
            ISection sec1 = new Section(SectionID.FromString("1234B012"));
            ISection sec2 = new Section(SectionID.FromString("1234B012"));

            Assert.AreEqual(sec1, sec2);
        }
        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);
            }
        }
        public void ISectionToString_Success()
        {
            string   sectionIdString = "1234B012";
            ISection section         = new Section(SectionID.FromString(sectionIdString));

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

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

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

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

            Assert.AreEqual(expected, actual);
        }
        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);
        }
        [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);
        }
        public void ID_ToString()
        {
            string     sectionId = "4321A121";
            ISectionID actual    = SectionID.FromString(sectionId);

            string actualString = actual.ToString();

            Assert.AreEqual(sectionId, actualString);
        }
        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());
        }
Exemple #13
0
 public void ISectionInstantiation_Success()
 {
     ISection section = new Section(SectionID.FromString("1234B012"));
 }
        public void FromString_StringTooLong()
        {
            SectionID.FromString("12345B012");

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

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

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