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."); } }
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); }
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); } }
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); } }
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."); } }
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); } }