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