コード例 #1
0
        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();
        }
コード例 #2
0
        public async void Update_Entity_Is_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();

            var record = await repository.Get(entity.Id);

            await repository.Update(record);

            var modifiedRecord = context.Set <TeacherXTeacherSkill>().FirstOrDefaultAsync();

            modifiedRecord.Should().NotBeNull();
        }