public TextController(TextBusiness textBusiness, IRssFeedRepository rssFeedRepository, FeedBusiness feedBusiness) { _textBusiness = textBusiness; _rssFeedRepository = rssFeedRepository; _feedBusiness = feedBusiness; }
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); }
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); }
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); }
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; }