Пример #1
0
 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);
            });
        }
Пример #3
0
 public ForumThreadsController(ForumThreadRepository forumThreadRepository)
 {
     this.forumThreadRepository = forumThreadRepository;
 }