public TextController(TextBusiness textBusiness, IRssFeedRepository rssFeedRepository,
                       FeedBusiness feedBusiness)
 {
     _textBusiness      = textBusiness;
     _rssFeedRepository = rssFeedRepository;
     _feedBusiness      = feedBusiness;
 }
Example #2
0
        public async Task CreateAsync_Ok()
        {
            var createText = new CreateText("words", "title", "lang");

            var textRepository = CreateTextRepositoryMock()
                                 .MockExistByTileAsync("title", false)
                                 .Resolve();


            var text = new TextBusiness(textRepository, EmptyUserRepository);

            await text.CreateAsync(createText);
        }
Example #3
0
        public async Task CreateAsync_InvalidTitle()
        {
            var textRepository = CreateTextRepositoryMock()
                                 .MockExistByTileAsync("title", true)
                                 .Resolve();

            var text = new TextBusiness(textRepository, EmptyUserRepository);

            var invalidParamException =
                await ThrowsAsync <InvalidParamException>(() =>
                                                          text.CreateAsync(new CreateText("words", "title", "lang")));

            Equal("Title", invalidParamException.ParamName);
            Equal("A text with this title is already stored", invalidParamException.Message);
        }
Example #4
0
        public async Task CreateBookmarkAsync_Ok()
        {
            var createBookmark = new CreateBookmark(1, 1);

            var textRepository = CreateTextRepositoryMock()
                                 .MockExist(1, true)
                                 .MockCreateBookmarkAsync(createBookmark)
                                 .Resolve();

            var userRepository = CreateUserRepositoryMock()
                                 .MockExistAsync(1, true)
                                 .Resolve();

            var text = new TextBusiness(textRepository, userRepository);
            await text.CreateBookmarkAsync(createBookmark);
        }
Example #5
0
        public async Task CreateBookmarkAsync_UserIdNotFound()
        {
            var textRepository = CreateTextRepositoryMock()
                                 .MockExist(1, true)
                                 .Resolve();

            var userRepository = CreateUserRepositoryMock()
                                 .MockExistAsync(1, false)
                                 .Resolve();

            var text = new TextBusiness(textRepository, userRepository);

            var notFoundException =
                await ThrowsAsync <NotFoundException>(() => text.CreateBookmarkAsync(new CreateBookmark(1, 1)));

            Equal("UserId not found", notFoundException.Message);
        }
 public FeedBusiness(IRssFeedRepository rssFeedRepository, TextBusiness textBusiness)
 {
     _rssFeedRepository = rssFeedRepository;
     _textBusiness      = textBusiness;
 }