示例#1
0
        public async Task GetPhotoStatsAsync_Id_ReturnsStats()
        {
            Stats expected = ClientTestUtilities.ShimGetAsync <GetPhotoStatsRequest, Stats>();

            PoseContext.Isolate(async() =>
            {
                Stats stats = await client.GetPhotoStatsAsync(string.Empty).ConfigureAwait(false);
                Assert.Equal(stats, expected);
            });
        }
示例#2
0
        public async Task SearchPhotosAsync_Query_ReturnsSearchResults()
        {
            PhotosSearchResults expected = ClientTestUtilities.ShimGetAsync <SearchPhotosRequest, PhotosSearchResults>();

            PoseContext.Isolate(async() =>
            {
                PhotosSearchResults results = await client.SearchPhotosAsync(string.Empty).ConfigureAwait(false);
                Assert.Equal(results, expected);
            });
        }
示例#3
0
        public async Task GetRandomPhotosAsync_Null_ReturnsAListOfPhotos()
        {
            List <Photo> expected = ClientTestUtilities.ShimGetAsync <GetRandomPhotosRequest, List <Photo> >();

            PoseContext.Isolate(async() =>
            {
                List <Photo> photos = await client.GetRandomPhotosAsync().ConfigureAwait(false);
                Assert.Equal(photos[0], expected[0]);
            });
        }
示例#4
0
        public async Task GetRandomPhotoAsync_Null_ReturnsAPhoto()
        {
            Photo expected = ClientTestUtilities.ShimGetAsync <GetPhotoRequest, Photo>();

            PoseContext.Isolate(async() =>
            {
                Photo photo = await client.GetRandomPhotoAsync().ConfigureAwait(false);
                Assert.Equal(photo, expected);
            });
        }
示例#5
0
        public async Task ListRelatedCollectionsAsync_Id_ReturnsACollection()
        {
            List <Collection> expected = ClientTestUtilities.ShimGetAsync <ListRelatedCollectionsRequest, List <Collection> >();

            PoseContext.Isolate(async() =>
            {
                List <Collection> result = await client.ListRelatedCollectionsAsync(string.Empty).ConfigureAwait(false);
                Assert.Equal(result, expected);
            });
        }
示例#6
0
        public async Task GetCollectionAsync_Null_ReturnsACollection()
        {
            Collection expected = ClientTestUtilities.ShimGetAsync <GetCollectionRequest, Collection>();

            PoseContext.Isolate(async() =>
            {
                Collection result = await client.GetCollectionAsync(string.Empty).ConfigureAwait(false);
                Assert.Equal(result, expected);
            });
        }
示例#7
0
        public async Task ListFeaturedCollectionsAsync_Null_ReturnsAListOfCollections()
        {
            List <Collection> expected = ClientTestUtilities.ShimGetAsync <ListFeaturedCollectionsRequest, List <Collection> >();

            PoseContext.Isolate(async() =>
            {
                List <Collection> result = await client.ListFeaturedCollectionsAsync().ConfigureAwait(false);
                Assert.Equal(result, expected);
            });
        }
示例#8
0
        public async Task DownloadPhotoAsync_UrlIdDestination_ReturnsTheSizeOfTheDownloadedFile()
        {
            var buffer = new byte[] { 1, 2 };

            ClientTestUtilities.ShimGetByteArrayAsync(buffer);
            ClientTestUtilities.ShimFileCreate();
            ClientTestUtilities.ShimGetAsync <DownloadPhotoRequest, PhotoDownloadMarker>();
            PoseContext.Isolate(async() =>
            {
                long fileSize = await client.DownloadPhotoAsync(new Uri("http://a.b.c"), "1", @"C:\1.jpg").ConfigureAwait(false);
                Assert.Equal(buffer.Length, fileSize);
            });
        }