public async void Get()
        {
            Mock <ILogger <RowVersionCheckRepository> > loggerMoc = RowVersionCheckRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = RowVersionCheckRepositoryMoc.GetContext();
            var repository = new RowVersionCheckRepository(loggerMoc.Object, context);

            RowVersionCheck entity = new RowVersionCheck();

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

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

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

            RowVersionCheck entity = new RowVersionCheck();

            entity.SetProperties(default(int), "B", Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"));
            context.Set <RowVersionCheck>().Add(entity);
            await context.SaveChangesAsync();

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

            record.Should().NotBeNull();
        }
        public async void Update_Entity_Is_Tracked()
        {
            Mock <ILogger <RowVersionCheckRepository> > loggerMoc = RowVersionCheckRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = RowVersionCheckRepositoryMoc.GetContext();
            var             repository   = new RowVersionCheckRepository(loggerMoc.Object, context);
            RowVersionCheck entity       = new RowVersionCheck();

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

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

            await repository.Update(record);

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

            modifiedRecord.Should().NotBeNull();
        }