コード例 #1
0
        public async Task TestIfReturnsCorrectPage(string id, string title, string content)
        {
            // Arrange
            var context = PCHUBDbContextInMemoryInitializer.InitializeContext();

            var forumService = new ForumServices(context);

            await context.ForumPosts.AddAsync(new Data.Models.ForumPost
            {
                Id        = id,
                Title     = title,
                Content   = content,
                CreatedOn = DateTime.UtcNow,
            });


            await context.SaveChangesAsync();

            //Act
            var result = await forumService.GetForumPostAsync(id);

            // Assert
            Assert.Equal(id, result.Id);
            Assert.Equal(title, result.Title);
            Assert.Equal(content, result.Content);
        }
コード例 #2
0
 public BoardController(
     ForumServices forumServices,
     SearchServices searchServices,
     ThreadServices threadServices,
     PostServices postServices,
     PollServices pollServices,
     GlobalServices globalServices,
     IRepository <OnlineUser> onlineUserRepository,
     IRepository <OnlineGuest> onlineGuestRepository,
     IRepository <User> userRepository,
     UserServices usersServices,
     RoleServices roleServices,
     MessageServices messageServices,
     PermissionServices permissionServices,
     FileServices fileServices,
     User currentUser,
     Theme currentTheme)
 {
     _forumServices         = forumServices;
     _searchServices        = searchServices;
     _threadServices        = threadServices;
     _postServices          = postServices;
     _pollServices          = pollServices;
     _onlineUserRepository  = onlineUserRepository;
     _onlineGuestRepository = onlineGuestRepository;
     _userRepository        = userRepository;
     _userServices          = usersServices;
     _roleServices          = roleServices;
     _messageServices       = messageServices;
     _permissionServices    = permissionServices;
     _fileServices          = fileServices;
     _currentUser           = currentUser;
     _currentTheme          = currentTheme;
     SetTopBreadCrumb("Board");
 }
コード例 #3
0
 public ForumsController(
     IRepository <Category> categoryRepository,
     IRepository <Forum> forumRepository,
     ForumServices forumServices,
     IRepository <Role> roleRepository,
     IRepository <ForumPermission> forumPermissionRepository,
     IRepository <Attachment> attachmentRepository,
     FileServices fileServices,
     CategoryServices categoryServices)
 {
     _categoryRepository        = categoryRepository;
     _forumRepository           = forumRepository;
     _forumServices             = forumServices;
     _roleRepository            = roleRepository;
     _forumPermissionRepository = forumPermissionRepository;
     _fileServices         = fileServices;
     _attachmentRepository = attachmentRepository;
     _categoryServices     = categoryServices;
     SetCrumb("Forums");
 }
コード例 #4
0
        public async Task TestIfReturnsCorrectPages()
        {
            // Arrange
            var context = PCHUBDbContextInMemoryInitializer.InitializeContext();

            var forumService = new ForumServices(context);

            await context.ForumPosts.AddAsync(new Data.Models.ForumPost
            {
                Id        = "One",
                Title     = "One",
                Content   = "One",
                CreatedOn = DateTime.UtcNow,
            });

            await context.ForumPosts.AddAsync(new Data.Models.ForumPost
            {
                Id        = "Two",
                Title     = "Two",
                Content   = "Two",
                CreatedOn = DateTime.UtcNow,
            });

            await context.ForumPosts.AddAsync(new Data.Models.ForumPost
            {
                Id        = "Three",
                Title     = "Three",
                Content   = "Three",
                CreatedOn = DateTime.UtcNow,
            });

            await context.SaveChangesAsync();

            //Act
            var result = await forumService.GetAllForumPostsAsync();

            // Assert
            Assert.Equal(3, result.Count);
        }
コード例 #5
0
 public PostController(
     IRepository<Smiley> smileyRepository,
     ForumServices forumServices,
     PostServices postServices,
     ThreadServices threadServices,
     FileServices fileServices,
     PollServices pollServices,
     EmailServices emailServices,
     PermissionServices permissionServices,
     ParseServices parseServices,
     User currentUser)
 {
     _smileyRepository = smileyRepository;
     _forumServices = forumServices;
     _postServices = postServices;
     _threadServices = threadServices;
     _fileServices = fileServices;
     _pollServices = pollServices;
     _emailServices = emailServices;
     _permissionServices = permissionServices;
     _parseServices = parseServices;
     _currentUser = currentUser;
 }
コード例 #6
0
 public HomeController(ForumServices services, TopicServices topicServices, UserServices userServices)
 {
     ForumServices      = services;
     this.TopicServices = topicServices;
     UserServices       = userServices;
 }