public async void Create() { Mock <ILogger <SalesPersonQuotaHistoryRepository> > loggerMoc = SalesPersonQuotaHistoryRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = SalesPersonQuotaHistoryRepositoryMoc.GetContext(); var repository = new SalesPersonQuotaHistoryRepository(loggerMoc.Object, context); var entity = new SalesPersonQuotaHistory(); await repository.Create(entity); var record = await context.Set <SalesPersonQuotaHistory>().FirstOrDefaultAsync(); record.Should().NotBeNull(); }
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_Not_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(); await repository.Update(new SalesPersonQuotaHistory()); var modifiedRecord = context.Set <SalesPersonQuotaHistory>().FirstOrDefaultAsync(); modifiedRecord.Should().NotBeNull(); }