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

            var entity = new LibraryVariableSet();
            await repository.Create(entity);

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

            record.Should().NotBeNull();
        }
Beispiel #2
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();
        }
Beispiel #3
0
        public async void Delete()
        {
            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();

            await repository.Delete(entity.Id);

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

            modifiedRecord.Should().BeNull();
        }
Beispiel #4
0
        public async void Update_Entity_Is_Not_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();

            await repository.Update(new LibraryVariableSet());

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

            modifiedRecord.Should().NotBeNull();
        }