public async void Create() { Mock <ILogger <SalesTaxRateRepository> > loggerMoc = SalesTaxRateRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = SalesTaxRateRepositoryMoc.GetContext(); var repository = new SalesTaxRateRepository(loggerMoc.Object, context); var entity = new SalesTaxRate(); await repository.Create(entity); var record = await context.Set <SalesTaxRate>().FirstOrDefaultAsync(); record.Should().NotBeNull(); }
public async void Get() { Mock <ILogger <SalesTaxRateRepository> > loggerMoc = SalesTaxRateRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = SalesTaxRateRepositoryMoc.GetContext(); var repository = new SalesTaxRateRepository(loggerMoc.Object, context); SalesTaxRate entity = new SalesTaxRate(); context.Set <SalesTaxRate>().Add(entity); await context.SaveChangesAsync(); var record = await repository.Get(entity.SalesTaxRateID); record.Should().NotBeNull(); }
public async void Delete() { Mock <ILogger <SalesTaxRateRepository> > loggerMoc = SalesTaxRateRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = SalesTaxRateRepositoryMoc.GetContext(); var repository = new SalesTaxRateRepository(loggerMoc.Object, context); SalesTaxRate entity = new SalesTaxRate(); context.Set <SalesTaxRate>().Add(entity); await context.SaveChangesAsync(); await repository.Delete(entity.SalesTaxRateID); SalesTaxRate modifiedRecord = await context.Set <SalesTaxRate>().FirstOrDefaultAsync(); modifiedRecord.Should().BeNull(); }
public async void Update_Entity_Is_Not_Tracked() { Mock <ILogger <SalesTaxRateRepository> > loggerMoc = SalesTaxRateRepositoryMoc.GetLoggerMoc(); ApplicationDbContext context = SalesTaxRateRepositoryMoc.GetContext(); var repository = new SalesTaxRateRepository(loggerMoc.Object, context); SalesTaxRate entity = new SalesTaxRate(); context.Set <SalesTaxRate>().Add(entity); await context.SaveChangesAsync(); await repository.Update(new SalesTaxRate()); var modifiedRecord = context.Set <SalesTaxRate>().FirstOrDefaultAsync(); modifiedRecord.Should().NotBeNull(); }