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