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