示例#1
0
        public async void Get()
        {
            Mock <ILogger <VersionInfoRepository> > loggerMoc = VersionInfoRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = VersionInfoRepositoryMoc.GetContext();
            var repository = new VersionInfoRepository(loggerMoc.Object, context);

            VersionInfo entity = new VersionInfo();

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

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

            record.Should().NotBeNull();
        }
示例#2
0
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <VersionInfoRepository> > loggerMoc = VersionInfoRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = VersionInfoRepositoryMoc.GetContext();
            var         repository       = new VersionInfoRepository(loggerMoc.Object, context);
            VersionInfo entity           = new VersionInfo();

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

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }