public async void Create() { Mock <ILogger <TableRepository> > loggerMoc = TableRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = TableRepositoryMoc.GetContext(); var repository = new TableRepository(loggerMoc.Object, context); var entity = new Table(); await repository.Create(entity); var record = await context.Set <Table>().FirstOrDefaultAsync(); record.Should().NotBeNull(); }
public async void Create() { Mock <ILogger <TableRepository> > loggerMoc = TableRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = TableRepositoryMoc.GetContext(); var repository = new TableRepository(loggerMoc.Object, context); var entity = new Table(); entity.SetProperties(default(int), "B"); await repository.Create(entity); var records = await context.Set <Table>().ToListAsync(); records.Count.Should().Be(2); }