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