Exemple #1
0
        public void DownloadProfileImageURL_ReturnsExpectedQuery()
        {
            // Arrange
            var parameters = new GetProfileImageParameters("https://url_normal.jpg")
            {
                ImageSize             = ImageSize.Bigger,
                CustomQueryParameters = { new Tuple <string, string>("hello", "world") }
            };

            var queryGenerator = CreateUserQueryGenerator();

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

            // Assert
            Assert.Equal(result, $"https://url_bigger.jpg?hello=world");
        }
Exemple #2
0
        public async Task GetProfileImageStream_ReturnsWebHelperResultAsync()
        {
            // Arrange
            var queryExecutor = CreateUserQueryExecutor();
            var stream        = A.Fake <Stream>();
            var url           = TestHelper.GenerateString();
            var request       = A.Fake <ITwitterRequest>();

            var parameter = new GetProfileImageParameters("some url");

            A.CallTo(() => _fakeUserQueryGenerator.DownloadProfileImageURL(parameter)).Returns(url);
            A.CallTo(() => _fakeWebHelper.GetResponseStreamAsync(request)).Returns(stream);

            // Act
            var result = await queryExecutor.GetProfileImageStreamAsync(parameter, request);

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