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