Beispiel #1
0
        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();
        }
Beispiel #2
0
        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();
        }