Exemple #1
0
        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;
        }
Exemple #3
0
        public ProductRepositoryTests()
        {
            _context           = new InMemoryDbContextFactory().GetDbContext();
            _productRepository = new ProductRepository(_context);

            _testUser = new User {
                Id           = 10,
                FirstName    = "Test",
                LastName     = "User",
                Username     = "******",
                PasswordHash = null,
                PasswordSalt = null
            };
        }
Exemple #4
0
 public UserServiceTests()
 {
     _context     = new InMemoryDbContextFactory().GetDbContext();
     _userService = new UserService(_context);
 }
Exemple #5
0
 public UserService(CraftItContext context)
 {
     _context = context;
 }
Exemple #6
0
 public ProductRepository(CraftItContext context)
 {
     _context = context;
 }
Exemple #7
0
 public CommentService(CraftItContext context)
 {
     _context = context;
 }