private static CareerManagerService MoqContext() { var opt = new DbContextOptionsBuilder <FacultadContext>() .UseInMemoryDatabase(databaseName: "CareerDB").Options; var context = new FacultadContext(opt); CareerManagerService careerManagerService = new CareerManagerService(context); return(careerManagerService); }
public void AddStudentStatusTest() { var mockRepo = new Mock <IBrainstormSessionRepository>(); FacultadContext facultadContext = new FacultadContext(); StudentSubject studentSubject = new StudentSubject(); studentSubject.IdCareer = 2; studentSubject.IdStudent = 2; studentSubject.IdSubject = 2; studentSubject.Status = "Finish"; studentSubject.Average = 6; var response = Assert.Fail(); }
public void Test_AddStudentSubject() { CareerManagerService careerManagerService = MoqContext(); var opt = new DbContextOptionsBuilder <FacultadContext>() .UseInMemoryDatabase(databaseName: "CareerDB").Options; var context = new FacultadContext(opt); var newStudentSubject = new StudentSubject() { IdCareer = 1, IdStudent = 1, IdSubject = 1, Status = "InProgress", Average = 7 }; var studentSubject = careerManagerService.AddStudentSubject(newStudentSubject); Assert.NotNull(studentSubject); Assert.True(studentSubject.IdStudentSubject > 0); }
public void Test_UpdateStudentSubject() { CareerManagerService careerManagerService = MoqContext(); var opt = new DbContextOptionsBuilder <FacultadContext>() .UseInMemoryDatabase(databaseName: "CareerDB").Options; var context = new FacultadContext(opt); var studentSubject1 = new StudentSubject() { IdCareer = 1, IdStudent = 1, IdSubject = 1, Status = "InProgress", Average = 7, IdStudentSubject = 1 }; var studentSubject = careerManagerService.UpdateStudentStatus(studentSubject1); Assert.NotNull(studentSubject); Assert.Equal(7, studentSubject.Average); }
public CareerManagerService(FacultadContext context) { _context = context; }