示例#1
0
        public async Task FetchAssetOnly()
        {
            AssetLibrary assetLibrary             = client.AssetLibrary().Only(new string[] { "url" });
            ContentstackCollection <Asset> assets = await assetLibrary.FetchAll();

            if (assets == null)
            {
                Assert.False(true, "Query.Exec is not match with expected result.");
            }
            else if (assets != null)
            {
                foreach (Asset asset in assets)
                {
                    Assert.DoesNotContain(asset.Url, "http");
                    Assert.Null(asset.Description);
                    Assert.Null(asset.FileSize);
                    Assert.Null(asset.Tags);
                    Assert.Null(asset.Description);
                }
            }
            else
            {
                Assert.False(true, "Result doesn't mathced the count.");
            }
        }
示例#2
0
        public async Task <string> FetchAssetUID()
        {
            AssetLibrary assetLibrary             = client.AssetLibrary();
            ContentstackCollection <Asset> assets = await assetLibrary.FetchAll();

            Assert.True(assets.Count() > 0);
            return(assets.First <Asset>().Uid);
        }
示例#3
0
        public async Task FetchAssets()
        {
            AssetLibrary assetLibrary             = client.AssetLibrary();
            ContentstackCollection <Asset> assets = await assetLibrary.FetchAll();

            Assert.True(assets.Count() > 0);
            foreach (Asset asset in assets)
            {
                Assert.True(asset.FileName.Length > 0);
            }
        }
示例#4
0
        public async Task FetchAssetsIncludeRelativeURL()
        {
            AssetLibrary assetLibrary = client.AssetLibrary();

            assetLibrary.IncludeRelativeUrls();
            ContentstackCollection <Asset> assets = await assetLibrary.FetchAll();

            Assert.True(assets.Count() > 0);
            foreach (Asset asset in assets)
            {
                Assert.DoesNotContain(asset.Url, "http");
                Assert.True(asset.FileName.Length > 0);
            }
        }
示例#5
0
        public async Task FetchAssetSkipLimit()
        {
            AssetLibrary assetLibrary             = client.AssetLibrary().SetLocale("en-us").Skip(2).Limit(5);
            ContentstackCollection <Asset> assets = await assetLibrary.FetchAll();

            if (assets == null)
            {
                Assert.False(true, "Query.Exec is not match with expected result.");
            }
            else if (assets != null)
            {
                Assert.Equal(3, assets.Items.Count());
            }
            else
            {
                Assert.False(true, "Result doesn't mathced the count.");
            }
        }
示例#6
0
        public async Task FetchAssetsOrderByAscending()
        {
            AssetLibrary assetLibrary = client.AssetLibrary();

            assetLibrary.SortWithKeyAndOrderBy("created_at", Internals.OrderBy.OrderByAscending);
            ContentstackCollection <Asset> assets = await assetLibrary.FetchAll();

            Assert.True(assets.Count() > 0);
            DateTime dateTime = new DateTime();

            foreach (Asset asset in assets)
            {
                if (dateTime != null)
                {
                    if (dateTime.CompareTo(asset.GetCreateAt()) != -1 && dateTime.CompareTo(asset.GetCreateAt()) != 0)
                    {
                        Assert.False(true);
                    }
                }
                dateTime = asset.GetCreateAt();
                Assert.True(asset.FileName.Length > 0);
            }
        }