예제 #1
0
        public async Task GetLinksAsync_WhenSubredditIsNull_ThrowsArgumentNullException()
        {
            IRedditAccessToken     accessToken = CreateRedditAccessToken();
            const IRedditSubreddit subreddit   = null;

            IRedditRepository sut = CreateSut();

            await sut.GetLinksAsync(accessToken, subreddit);
        }
예제 #2
0
        public async Task GetSpecificSubredditAsync_WhenKnownSubredditIsNull_ThrowsArgumentNullException()
        {
            IRedditAccessToken          accessToken    = CreateRedditAccessToken();
            const IRedditKnownSubreddit knownSubreddit = null;

            IRedditRepository sut = CreateSut();

            await sut.GetSpecificSubredditAsync(accessToken, knownSubreddit);
        }
        public async Task GetSubredditsForAuthenticatedUserAsync_WhenCalled_AssertHandleAsyncWasCalledOnExceptionHandler()
        {
            IRedditAccessToken redditAccessToken = CreateRedditAccessToken();

            IRedditRepository sut = CreateSut();

            await sut.GetSubredditsForAuthenticatedUserAsync(redditAccessToken);

            _exceptionHandlerMock.Verify(m => m.HandleAsync(It.Is <Exception>(exception =>
                                                                              exception != null &&
                                                                              exception.InnerException == null &&
                                                                              exception.GetType() == typeof(UnauthorizedAccessException))),
                                         Times.Once());
        }
예제 #4
0
 public PostController(IRedditRepository <Post> postRepo)
 {
     this.postRepo = postRepo;
 }
        public async Task GetSubredditsForAuthenticatedUserAsync_WhenAccessTokenIsNull_ThrowsArgumentNullException()
        {
            IRedditRepository sut = CreateSut();

            await sut.GetSubredditsForAuthenticatedUserAsync(null);
        }
예제 #6
0
 public RedditController(IRedditAccess reddit, IRedditRepository repository)
 {
     _reddit     = reddit;
     _repository = repository;
 }