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