Example #1
0
        public Task <ITwitterResult <IUserDTO> > MuteUser(IMuteUserParameters parameters, ITwitterRequest request)
        {
            var query = _userQueryGenerator.GetMuteUserQuery(parameters);

            request.Query.Url        = query;
            request.Query.HttpMethod = HttpMethod.POST;
            return(_twitterAccessor.ExecuteRequest <IUserDTO>(request));
        }
Example #2
0
        public async Task MutedUser_ReturnsUserDTOAsync()
        {
            // Arrange
            var queryExecutor = CreateUserQueryExecutor();

            var url            = TestHelper.GenerateString();
            var parameters     = new MuteUserParameters(42);
            var request        = A.Fake <ITwitterRequest>();
            var expectedResult = A.Fake <ITwitterResult <IUserDTO> >();

            A.CallTo(() => _fakeUserQueryGenerator.GetMuteUserQuery(parameters)).Returns(url);
            A.CallTo(() => _fakeTwitterAccessor.ExecuteRequestAsync <IUserDTO>(request)).Returns(expectedResult);

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

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