예제 #1
0
        public async void Create()
        {
            Mock <ILogger <AWBuildVersionRepository> > loggerMoc = AWBuildVersionRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = AWBuildVersionRepositoryMoc.GetContext();
            var repository = new AWBuildVersionRepository(loggerMoc.Object, context);

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

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

            record.Should().NotBeNull();
        }
예제 #2
0
        public async void Get()
        {
            Mock <ILogger <AWBuildVersionRepository> > loggerMoc = AWBuildVersionRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = AWBuildVersionRepositoryMoc.GetContext();
            var repository = new AWBuildVersionRepository(loggerMoc.Object, context);

            AWBuildVersion entity = new AWBuildVersion();

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

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

            record.Should().NotBeNull();
        }
예제 #3
0
        public async void Delete()
        {
            Mock <ILogger <AWBuildVersionRepository> > loggerMoc = AWBuildVersionRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = AWBuildVersionRepositoryMoc.GetContext();
            var            repository    = new AWBuildVersionRepository(loggerMoc.Object, context);
            AWBuildVersion entity        = new AWBuildVersion();

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

            await repository.Delete(entity.SystemInformationID);

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

            modifiedRecord.Should().BeNull();
        }
예제 #4
0
        public async void Update_Entity_Is_Not_Tracked()
        {
            Mock <ILogger <AWBuildVersionRepository> > loggerMoc = AWBuildVersionRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = AWBuildVersionRepositoryMoc.GetContext();
            var            repository    = new AWBuildVersionRepository(loggerMoc.Object, context);
            AWBuildVersion entity        = new AWBuildVersion();

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

            await repository.Update(new AWBuildVersion());

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

            modifiedRecord.Should().NotBeNull();
        }