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