public CommentServiceTests() { _context = new InMemoryDbContextFactory().GetDbContext(); _commentService = new CommentService(_context); _productRepository = new ProductRepository(_context); _testUser = new User { Id = 10, FirstName = "Test", LastName = "User", Username = "******", PasswordHash = null, PasswordSalt = null }; _testProduct = new Product { Id = 1, Name = "Test product 2", Description = "A description", AddedBy = _testUser, TimeEstimate = "5 hours", ProductImage = null, Requirements = "[]", Comments = new Collection <Comment>(), Instructions = new Collection <Instruction>() }; }
public CraftItContext GetDbContext() { var options = new DbContextOptionsBuilder<CraftItContext>() .UseInMemoryDatabase(databaseName: "InMemoryArticleDatabase") .Options; var dbContext = new CraftItContext(options); return dbContext; }
public ProductRepositoryTests() { _context = new InMemoryDbContextFactory().GetDbContext(); _productRepository = new ProductRepository(_context); _testUser = new User { Id = 10, FirstName = "Test", LastName = "User", Username = "******", PasswordHash = null, PasswordSalt = null }; }
public UserServiceTests() { _context = new InMemoryDbContextFactory().GetDbContext(); _userService = new UserService(_context); }
public UserService(CraftItContext context) { _context = context; }
public ProductRepository(CraftItContext context) { _context = context; }
public CommentService(CraftItContext context) { _context = context; }