Beispiel #1
0
        public async void Get()
        {
            Mock <ILogger <DatabaseLogRepository> > loggerMoc = DatabaseLogRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = DatabaseLogRepositoryMoc.GetContext();
            var repository = new DatabaseLogRepository(loggerMoc.Object, context);

            DatabaseLog entity = new DatabaseLog();

            context.Set <DatabaseLog>().Add(entity);
            await context.SaveChangesAsync();

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

            record.Should().NotBeNull();
        }
Beispiel #2
0
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <DatabaseLogRepository> > loggerMoc = DatabaseLogRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = DatabaseLogRepositoryMoc.GetContext();
            var         repository       = new DatabaseLogRepository(loggerMoc.Object, context);
            DatabaseLog entity           = new DatabaseLog();

            context.Set <DatabaseLog>().Add(entity);
            await context.SaveChangesAsync();

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }