Exemple #1
0
        public void T4_SaveToId()
        {
            //Arrange
            DateTime Date1    = new DateTime(2016, 08, 01);
            Student  student1 = new Student("Jon", "Jone", "*****@*****.**", "/img/jon.jpg", Date1);

            student1.Save();

            //Act
            //Student savedId = Student.GetAll()[0];
            Student savedId = Student.Find(student1.GetId());


            int result = savedId.GetId();
            int testId = student1.GetId();

            //Assert
            Assert.Equal(testId, result);
        }
Exemple #2
0
        public void T10_DeleteCourse()
        {
            //Assert
            DateTime Date1      = new DateTime(2016, 08, 01);
            Course   testCourse = new Course("Intro", Date1, 1);

            testCourse.Save();

            Student student1 = new Student("Jon", "Jone", "*****@*****.**", "/img/jon.jpg", Date1);

            student1.Save();


            //Act
            testCourse.AddStudent(student1);
            testCourse.DeleteStudent(student1.GetId());
            int result = testCourse.GetStudents().Count;

            //Assert
            Assert.Equal(0, result);
        }
Exemple #3
0
        public void T6_UpdateAll()
        {
            //Arrange
            DateTime Date1    = new DateTime(2016, 08, 01);
            Student  student1 = new Student("Jon", "Jone", "*****@*****.**", "/img/jon.jpg", Date1);

            student1.Save();

            Student currentStudent = new Student("Jon", "Jone", "*****@*****.**", "/img/jon.jpg", Date1, student1.GetId());

            //Act
            student1.UpdateAll(currentStudent);
            //  student1.UpdateAll(currentStudent);
            // static void .. error CS0176: Member 'Student.UpdateAll(Student)' cannot be accessed with an instance reference; qualify it with a type name instead
            //Assert
            Assert.Equal(currentStudent, student1);
        }