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