Exemple #1
0
        public void SubjectsTest()
        {
            Subjects mySubs = new Subjects(6);
            Subject  s1     = new SchoolRecords.Subject("Geography", "A Level");

            mySubs.AddSubject(s1);
            Assert.AreEqual(1, mySubs.GetCurrentSize());;
            Subject s2 = new SchoolRecords.Subject("French", "A Level");

            mySubs.AddSubject(s2);
            Assert.AreEqual("French", mySubs.GetSubject(1).GetName());
            Assert.AreEqual(mySubs.GetCurrentSize(), 2);
            Assert.AreEqual(0, mySubs.RemoveSubject("Geography", "A Level"));
            Assert.AreEqual(-1, mySubs.RemoveSubject("Geography", "A Level"));
            Assert.AreEqual(mySubs.GetCurrentSize(), 1);
            Assert.AreEqual("French", mySubs.GetSubject(0).GetName());
            Assert.AreEqual(0, mySubs.RemoveSubject("French", "A Level"));
            Assert.AreEqual(mySubs.GetCurrentSize(), 0);
            Subject s3 = new SchoolRecords.Subject("Maths", "BTEC");

            mySubs.AddSubject(s3);
            Subject s4 = new SchoolRecords.Subject("Comp Sci", "A Level");

            mySubs.AddSubject(s4);
            Assert.AreEqual(mySubs.GetCurrentSize(), 2);
            mySubs.AddSubject(s4);
            mySubs.AddSubject(s4);
            Assert.AreEqual(mySubs.GetCurrentSize(), 4);
        }
Exemple #2
0
        public void getCurrentSizeTest()
        {
            Subjects mySubs = new Subjects();

            Assert.AreEqual(mySubs.getCurrentSize(), 0);
            Subject s1 = new SchoolRecords.Subject("French", "A Level");

            mySubs.addSubject(ref s1);
            Assert.AreEqual(mySubs.getCurrentSize(), 1);
        }