Ejemplo n.º 1
0
        public async void Get()
        {
            Mock <ILogger <LibraryVariableSetRepository> > loggerMoc = LibraryVariableSetRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = LibraryVariableSetRepositoryMoc.GetContext();
            var repository = new LibraryVariableSetRepository(loggerMoc.Object, context);

            LibraryVariableSet entity = new LibraryVariableSet();

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

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

            record.Should().NotBeNull();
        }
Ejemplo n.º 2
0
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <LibraryVariableSetRepository> > loggerMoc = LibraryVariableSetRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = LibraryVariableSetRepositoryMoc.GetContext();
            var repository            = new LibraryVariableSetRepository(loggerMoc.Object, context);
            LibraryVariableSet entity = new LibraryVariableSet();

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

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }