public TeacherRepositoryTest()
 {
     this._dbContext      = new Mock <ClassroomSailorDbContext>();
     this._mockTeacherSet = new Mock <DbSet <TeacherEntity> >();
     this._teachers       = new List <TeacherEntity>()
     {
         new TeacherEntity()
         {
             Id            = 1,
             FirstName     = "FirstName1",
             MiddleName    = "MiddleName1",
             LastName      = "LastName1",
             Email         = "*****@*****.**",
             BirthDate     = new DateTime(1980, 1, 12, 10, 10, 0, 0, DateTimeKind.Local),
             JoiningDate   = new DateTime(2018, 4, 8, 8, 0, 0, 0, DateTimeKind.Local),
             ContactNumber = "0140-5879-2456",
             Subjects      = new List <SubjectEntity>()
             {
                 new SubjectEntity()
                 {
                     Id = 1, Name = "Algebra"
                 },
                 new SubjectEntity()
                 {
                     Id = 2, Name = "Biology"
                 },
             }
         },
         new TeacherEntity()
         {
             Id            = 2,
             FirstName     = "FirstName2",
             MiddleName    = "MiddleName2",
             LastName      = "LastName2",
             Email         = "*****@*****.**",
             BirthDate     = new DateTime(1988, 11, 21, 23, 0, 0, 0, DateTimeKind.Local),
             JoiningDate   = new DateTime(2017, 9, 18, 8, 30, 0, 0, DateTimeKind.Local),
             ContactNumber = "0120-2332-4774",
             Subjects      = new List <SubjectEntity>()
             {
                 new SubjectEntity()
                 {
                     Id = 1, Name = "Algebra"
                 },
                 new SubjectEntity()
                 {
                     Id = 2, Name = "Biology"
                 },
             }
         }
     }.AsQueryable();
     this._mockTeacherSet.As <IQueryable <TeacherEntity> >().Setup(m => m.Provider).Returns(this._teachers.Provider);
     this._mockTeacherSet.As <IQueryable <TeacherEntity> >().Setup(m => m.Expression).Returns(this._teachers.Expression);
     this._mockTeacherSet.As <IQueryable <TeacherEntity> >().Setup(m => m.ElementType).Returns(this._teachers.ElementType);
     this._mockTeacherSet.As <IQueryable <TeacherEntity> >().Setup(m => m.GetEnumerator()).Returns(this._teachers.GetEnumerator());
     this._teacherRepository = new TeacherRepository(this._dbContext.Object);
 }
Exemplo n.º 2
0
 public StudentService(IClassroomSailorUserRepository <StudentEntity> repository, IStudentEntityFactory <T> studentFactory)
 {
     this._repository     = repository;
     this._studentFactory = studentFactory;
 }
 public TeacherService(IClassroomSailorUserRepository <TeacherEntity> repository, ITeacherEntityFactory <T> teacherFactory)
 {
     this._repository     = repository;
     this._teacherFactory = teacherFactory;
 }