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