public async void Create() { Mock <ILogger <TeacherXTeacherSkillRepository> > loggerMoc = TeacherXTeacherSkillRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = TeacherXTeacherSkillRepositoryMoc.GetContext(); var repository = new TeacherXTeacherSkillRepository(loggerMoc.Object, context); var entity = new TeacherXTeacherSkill(); await repository.Create(entity); var record = await context.Set <TeacherXTeacherSkill>().FirstOrDefaultAsync(); record.Should().NotBeNull(); }
public async void Get() { Mock <ILogger <TeacherXTeacherSkillRepository> > loggerMoc = TeacherXTeacherSkillRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = TeacherXTeacherSkillRepositoryMoc.GetContext(); var repository = new TeacherXTeacherSkillRepository(loggerMoc.Object, context); TeacherXTeacherSkill entity = new TeacherXTeacherSkill(); context.Set <TeacherXTeacherSkill>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.Id); record.Should().NotBeNull(); }
public async void Delete() { Mock <ILogger <TeacherXTeacherSkillRepository> > loggerMoc = TeacherXTeacherSkillRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = TeacherXTeacherSkillRepositoryMoc.GetContext(); var repository = new TeacherXTeacherSkillRepository(loggerMoc.Object, context); TeacherXTeacherSkill entity = new TeacherXTeacherSkill(); context.Set <TeacherXTeacherSkill>().Add(entity); await context.SaveChangesAsync(); await repository.Delete(entity.Id); TeacherXTeacherSkill modifiedRecord = await context.Set <TeacherXTeacherSkill>().FirstOrDefaultAsync(); modifiedRecord.Should().BeNull(); }
public async void Update_Entity_Is_Not_Tracked() { Mock <ILogger <TeacherXTeacherSkillRepository> > loggerMoc = TeacherXTeacherSkillRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = TeacherXTeacherSkillRepositoryMoc.GetContext(); var repository = new TeacherXTeacherSkillRepository(loggerMoc.Object, context); TeacherXTeacherSkill entity = new TeacherXTeacherSkill(); context.Set <TeacherXTeacherSkill>().Add(entity); await context.SaveChangesAsync(); await repository.Update(new TeacherXTeacherSkill()); var modifiedRecord = context.Set <TeacherXTeacherSkill>().FirstOrDefaultAsync(); modifiedRecord.Should().NotBeNull(); }