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