public async void Create() { Mock <ILogger <RetweetRepository> > loggerMoc = RetweetRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = RetweetRepositoryMoc.GetContext(); var repository = new RetweetRepository(loggerMoc.Object, context); var entity = new Retweet(); await repository.Create(entity); var record = await context.Set <Retweet>().FirstOrDefaultAsync(); record.Should().NotBeNull(); }
public async void Create() { Mock <ILogger <RetweetRepository> > loggerMoc = RetweetRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = RetweetRepositoryMoc.GetContext(); var repository = new RetweetRepository(loggerMoc.Object, context); var entity = new Retweet(); entity.SetProperties(default(int), DateTime.Parse("1/1/1988 12:00:00 AM"), 1, TimeSpan.Parse("02:00:00"), 1); await repository.Create(entity); var records = await context.Set <Retweet>().ToListAsync(); records.Count.Should().Be(2); }