示例#1
0
        public async void Delete()
        {
            Mock <ILogger <PostHistoryRepository> > loggerMoc = PostHistoryRepositoryMoc.GetLoggerMoc();
            ApplicationDbContext context = PostHistoryRepositoryMoc.GetContext();
            var         repository       = new PostHistoryRepository(loggerMoc.Object, context);
            PostHistory entity           = new PostHistory();

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

            await repository.Delete(entity.Id);

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

            modifiedRecord.Should().BeNull();
        }