public async void Get() { Mock <ILogger <ChannelRepository> > loggerMoc = ChannelRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = ChannelRepositoryMoc.GetContext(); var repository = new ChannelRepository(loggerMoc.Object, context); Channel entity = new Channel(); context.Set <Channel>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.Id); record.Should().NotBeNull(); }
public async void Update_Entity_Is_Tracked() { Mock <ILogger <ChannelRepository> > loggerMoc = ChannelRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = ChannelRepositoryMoc.GetContext(); var repository = new ChannelRepository(loggerMoc.Object, context); Channel entity = new Channel(); context.Set <Channel>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.Id); await repository.Update(record); var modifiedRecord = context.Set <Channel>().FirstOrDefaultAsync(); modifiedRecord.Should().NotBeNull(); }