コード例 #1
0
        public void GetById()
        {
            // Arrange
            StudentsEntities context = new StudentsEntities();
            var repository = new StudentsRepository(context);

            // Act
            Student result = repository.Get(3);

            // Assert
            Student expectedStudent = new Student()
            {
                firstName = "pesho",
                lastName = "peshev",
                age = 20,
                grade = 5
            };

            Assert.AreEqual(expectedStudent.firstName, result.firstName);
            Assert.AreEqual(expectedStudent.lastName, result.lastName);
            Assert.AreEqual(expectedStudent.age, result.age);
            Assert.AreEqual(expectedStudent.grade, result.grade);
        }
コード例 #2
0
 public SchoolsController()
 {
     dbContext = new StudentsEntities();
     this.repository = new SchoolsRepository(dbContext);
 }
コード例 #3
0
 public MarksController()
 {
     dbContext = new StudentsEntities();
     this.repository = new MarksRepository(dbContext);
 }