public async void Get() { Mock <ILogger <LessonXStudentRepository> > loggerMoc = LessonXStudentRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = LessonXStudentRepositoryMoc.GetContext(); var repository = new LessonXStudentRepository(loggerMoc.Object, context); LessonXStudent entity = new LessonXStudent(); context.Set <LessonXStudent>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.Id); record.Should().NotBeNull(); }
public async void Update_Entity_Is_Tracked() { Mock <ILogger <LessonXStudentRepository> > loggerMoc = LessonXStudentRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = LessonXStudentRepositoryMoc.GetContext(); var repository = new LessonXStudentRepository(loggerMoc.Object, context); LessonXStudent entity = new LessonXStudent(); context.Set <LessonXStudent>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.Id); await repository.Update(record); var modifiedRecord = context.Set <LessonXStudent>().FirstOrDefaultAsync(); modifiedRecord.Should().NotBeNull(); }