public async void Create() { Mock <ILogger <PostHistoryRepository> > loggerMoc = PostHistoryRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = PostHistoryRepositoryMoc.GetContext(); var repository = new PostHistoryRepository(loggerMoc.Object, context); var entity = new PostHistory(); await repository.Create(entity); var record = await context.Set <PostHistory>().FirstOrDefaultAsync(); record.Should().NotBeNull(); }
public async void Create() { Mock <ILogger <PostHistoryRepository> > loggerMoc = PostHistoryRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = PostHistoryRepositoryMoc.GetContext(); var repository = new PostHistoryRepository(loggerMoc.Object, context); var entity = new PostHistory(); entity.SetProperties(default(int), "B", DateTime.Parse("1/1/1988 12:00:00 AM"), 1, 1, "B", "B", "B", 1); await repository.Create(entity); var records = await context.Set <PostHistory>().ToListAsync(); records.Count.Should().Be(2); }