예제 #1
0
        public async Task GetUserIdsWhoseRetweetsAreMuted_ReturnsFromUserQueryExecutor()
        {
            // arrange
            var accountController = CreateUserController();
            var parameters        = new GetUserIdsWhoseRetweetsAreMutedParameters();
            var request           = A.Fake <ITwitterRequest>();
            var expectedResult    = A.Fake <ITwitterResult <long[]> >();

            A.CallTo(() => _fakeUserQueryExecutor.GetUserIdsWhoseRetweetsAreMuted(parameters, request)).Returns(expectedResult);

            // act
            var result = await accountController.GetUserIdsWhoseRetweetsAreMuted(parameters, request);

            // assert
            Assert.Same(result, expectedResult);
        }
예제 #2
0
        public void GetUserIdsWhoseRetweetsAreMutedQuery_ReturnsExpectedQuery()
        {
            // Arrange
            var queryGenerator = CreateUserQueryGenerator();

            var parameters = new GetUserIdsWhoseRetweetsAreMutedParameters
            {
                CustomQueryParameters = { new Tuple <string, string>("hello", "world") }
            };

            // Act
            var result = queryGenerator.GetUserIdsWhoseRetweetsAreMutedQuery(parameters);

            // Assert
            Assert.Equal(result, $"https://api.twitter.com/1.1/friendships/no_retweets/ids.json?hello=world");
        }
예제 #3
0
        public async Task GetUserIdsWhoseRetweetsAreMuted_ReturnsUserIdsAsync()
        {
            // Arrange
            var queryExecutor = CreateUserQueryExecutor();

            var url            = TestHelper.GenerateString();
            var parameters     = new GetUserIdsWhoseRetweetsAreMutedParameters();
            var request        = A.Fake <ITwitterRequest>();
            var expectedResult = A.Fake <ITwitterResult <long[]> >();

            A.CallTo(() => _fakeUserQueryGenerator.GetUserIdsWhoseRetweetsAreMutedQuery(parameters)).Returns(url);
            A.CallTo(() => _fakeTwitterAccessor.ExecuteRequestAsync <long[]>(request)).Returns(expectedResult);

            // Act
            var result = await queryExecutor.GetUserIdsWhoseRetweetsAreMutedAsync(parameters, request);

            // Assert
            Assert.Equal(result, expectedResult);
            Assert.Equal(request.Query.Url, url);
            Assert.Equal(HttpMethod.GET, request.Query.HttpMethod);
        }