Esempio n. 1
0
        public async void Get()
        {
            Mock <ILogger <InterruptionRepository> > loggerMoc = InterruptionRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = InterruptionRepositoryMoc.GetContext();
            var repository = new InterruptionRepository(loggerMoc.Object, context);

            Interruption entity = new Interruption();

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

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

            record.Should().NotBeNull();
        }
Esempio n. 2
0
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <InterruptionRepository> > loggerMoc = InterruptionRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = InterruptionRepositoryMoc.GetContext();
            var          repository      = new InterruptionRepository(loggerMoc.Object, context);
            Interruption entity          = new Interruption();

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

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }