public CategoryRepositoryTests() { DbContextOptionsBuilder <MMTShopContext> optionsBuilder = new DbContextOptionsBuilder <MMTShopContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()); _context = new MMTShopContext(optionsBuilder.Options); _context.Categories.AddRange(new List <Category>() { new Category() { Id = Guid.NewGuid(), Name = "CategoryOne" }, new Category() { Id = Guid.NewGuid(), Name = "CategoryTwo" }, new Category() { Id = Guid.NewGuid(), Name = "CategoryThree" } }); _context.SaveChanges(); _logger = new NullLogger <CategoryRepository>(); }
public ProductRepositoryTests() { DbContextOptionsBuilder <MMTShopContext> optionsBuilder = new DbContextOptionsBuilder <MMTShopContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()); _context = new MMTShopContext(optionsBuilder.Options); _context.Products.AddRange(new List <Product>() { new Product() { Sku = "12345", Name = "Product1", Description = "Product1 is nice", Price = 9.99d }, new Product() { Sku = "22345", Name = "Product2", Description = "Product2 is nice", Price = 9.99d }, new Product() { Sku = "32345", Name = "Product3", Description = "Product3 is nice", Price = 9.99d }, new Product() { Sku = "42345", Name = "Product4", Description = "Product4 is nice", Price = 9.99d }, new Product() { Sku = "52345", Name = "Product5", Description = "Product5 is nice", Price = 9.99d }, }); _context.SaveChanges(); _logger = new NullLogger <ProductRepository>(); _configMock = new Mock <IOptions <ApiOptions> >(); }
public CategoryController(MMTShopContext context) { _context = context; }
public ProductController(MMTShopContext context) { _context = context; }
public ProductRepository(MMTShopContext context) { this._context = context; }
public UnitOfWork(string connectionString) { var contextOptions = new DbContextOptionsBuilder <MMTShopContext>().UseSqlServer(connectionString).Options; _MMTShopContext = new MMTShopContext(contextOptions); }
public CategoryRepository(MMTShopContext context) { this._context = context; }