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