public UnitOfWork(InternetForumDbContext dbContext) { this.dbContext = dbContext; this.commentRepository = new CommentRepository(dbContext); this.forumThreadRepository = new ForumThreadRepository(dbContext); this.postRepository = new PostRepository(dbContext); this.userRepository = new ApplicationUserRepository(dbContext); }
public void TestGetByCategoryId() { RunOnDatabase(async s => { DestroyDatabase(); // Arrange var repository = new ForumThreadRepository(s); Guid userId = Guid.NewGuid(); Guid categoryId = Guid.NewGuid(); // Act await repository.Add(Thread.Create("nume", "descriere", userId, categoryId)); // Assert IEnumerable <Thread> th = await repository.GetByCategoryId(categoryId); Assert.AreEqual(userId, th.First().UserId); }); }
public ForumThreadsController(ForumThreadRepository forumThreadRepository) { this.forumThreadRepository = forumThreadRepository; }