예제 #1
0
 public override void SetUp()
 {
     base.SetUp();
     DeleteBase("t-school.ndb");
     var odb = Open("t-school.ndb");
     var query = odb.Query<Student>();
     var students = query.Execute<Student>(true);
     var numStudents = students.Count;
     var computerScience = new Course("Computer Science");
     var teacher = new Teacher("Jeremias", "Java");
     var dw1 = new Discipline("Des. Web 1", 3);
     var @is = new Discipline("Intranet/Segurança", 4);
     var std1 = new Student(20, computerScience, new DateTime(), "1cs", "Brenna");
     var h1 = new History(new DateTime(), dw1, 0, teacher);
     var h2 = new History(new DateTime(), @is, 0, teacher);
     std1.AddHistory(h1);
     std1.AddHistory(h2);
     odb.Store(std1);
     odb.Commit();
     odb.Close();
     odb = Open("t-school.ndb");
     var query1 = odb.Query<Student>();
     students = query1.Execute<Student>(true);
     odb.Close();
     AssertEquals(numStudents + 1, students.Count);
 }
예제 #2
0
파일: Student.cs 프로젝트: danfma/NDB
 public virtual void AddHistory(History history)
 {
     history.SetStudent(this);
     listHistory.Add(history);
 }