Skip to content

Commit 8670c21

Browse files
authored
Merge pull request #2 from contentstack/develop
Develop
2 parents 5c9e192 + 656243a commit 8670c21

30 files changed

Lines changed: 2264 additions & 2147 deletions

CHANGELOG.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,47 @@
1+
### Version: 2.0
2+
#### Date: Jun-28-2019
3+
4+
##### New Features:
5+
- Query
6+
- added method 'SetLocale'
7+
8+
- Entry
9+
- added method 'SetLocale'
10+
11+
##### Update API
12+
- Query
13+
- update method 'Fetch'
14+
- update method 'FindOne'
15+
16+
- Entry
17+
- update method 'Find'
18+
19+
##### Deprecated API
20+
- Query
21+
- deprecated method 'SetLanguage'
22+
23+
- Entry
24+
- deprecated method 'SetLanguage'
25+
126
### Version: 1.1.0
227
#### Date: Apr-12-2019
328

429
##### New Features:
530
- ContentstackClient
631
- added method 'GetContentTypes'
732
- added method 'SyncRecursive'
8-
- added method 'SyncRecursiveLanguage'
933
- added method 'SyncPaginationToken'
1034
- added method 'SyncToken'
1135

1236
- CotentType
13-
- added method 'Fetch'
14-
37+
- added method 'Fetch'
38+
1539
### Version: 1.0.6
16-
#### Date: Apr-12-2019
40+
#### Date: Aug-10-2018
1741

1842
Localization support for Query and Entry is added.
1943

2044
### Version: 1.0.0
21-
#### Date: Apr-12-2019
45+
#### Date: Jun-1-2018
2246

2347
- Introduce ContentStack SDK for DOTNET.

Contentstack.AspNetCore/Contentstack.AspNetCore.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<PackageId>contentstack.aspnetcore</PackageId>
77
<Authors>Contentstack</Authors>
88
<Owners>Contentstack</Owners>
9-
<ReleaseVersion>1.1.0</ReleaseVersion>
9+
<ReleaseVersion>2.0</ReleaseVersion>
1010
<PackageVersion>1.0.0</PackageVersion>
1111
<Description>Main release</Description>
1212
<Copyright>Copyright (c) 2012-2019 Contentstack (http://app.contentstack.com). All Rights Reserved
@@ -23,7 +23,7 @@
2323
<ItemGroup>
2424
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.2" />
2525
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1.1" />
26-
<PackageReference Include="contentstack.csharp" Version="1.0.6" />
26+
<PackageReference Include="contentstack.csharp" Version="1.1.0" />
2727
<PackageReference Include="NuGet.Build.Packaging" Version="0.2.0" />
2828
</ItemGroup>
2929
</Project>
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
using System;
2+
using Xunit;
3+
using Contentstack.Core.Models;
4+
using System.Threading.Tasks;
5+
using Contentstack.Core.Configuration;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
using System.Text.RegularExpressions;
9+
using System.Collections;
10+
11+
namespace Contentstack.Core.Tests
12+
{
13+
public class AssetTest
14+
{
15+
ContentstackClient client = StackConfig.GetStack();
16+
17+
[Fact]
18+
public async Task FetchAssetByUid()
19+
{
20+
Asset asset = client.Asset("blt649cfadb08b577db");
21+
await asset.Fetch().ContinueWith((t) =>
22+
{
23+
Asset result = t.Result;
24+
if (result == null)
25+
{
26+
Assert.False(true, "Entry.Fetch is not match with expected result.");
27+
}
28+
else
29+
{
30+
Assert.True(result.FileName.Length > 0);
31+
}
32+
});
33+
}
34+
35+
[Fact]
36+
public async Task FetchAssets()
37+
{
38+
AssetLibrary assetLibrary = client.AssetLibrary();
39+
ContentstackCollection<Asset> assets = await assetLibrary.FetchAll();
40+
Assert.True(assets.Count() > 0);
41+
foreach (Asset asset in assets)
42+
{
43+
Assert.True(asset.FileName.Length > 0);
44+
}
45+
}
46+
47+
[Fact]
48+
public async Task FetchAssetsOrderByAscending()
49+
{
50+
AssetLibrary assetLibrary = client.AssetLibrary();
51+
assetLibrary.SortWithKeyAndOrderBy("created_at", Internals.OrderBy.OrderByAscending);
52+
ContentstackCollection<Asset> assets = await assetLibrary.FetchAll();
53+
Assert.True(assets.Count() > 0);
54+
DateTime dateTime = new DateTime();
55+
foreach (Asset asset in assets)
56+
{
57+
if (dateTime != null)
58+
{
59+
if (dateTime.CompareTo(asset.GetCreateAt()) != -1)
60+
{
61+
Assert.False(true);
62+
}
63+
}
64+
dateTime = asset.GetCreateAt();
65+
Assert.True(asset.FileName.Length > 0);
66+
}
67+
}
68+
69+
[Fact]
70+
public async Task FetchAssetsIncludeRelativeURL()
71+
{
72+
AssetLibrary assetLibrary = client.AssetLibrary();
73+
assetLibrary.IncludeRelativeUrls();
74+
ContentstackCollection<Asset> assets = await assetLibrary.FetchAll();
75+
Assert.True(assets.Count() > 0);
76+
foreach (Asset asset in assets)
77+
{
78+
Assert.DoesNotContain(asset.Url, "http");
79+
Assert.True(asset.FileName.Length > 0);
80+
}
81+
}
82+
}
83+
}

Contentstack.Core.Tests/Contentstack.Core.Tests.csproj

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<TargetFramework>netcoreapp2.0</TargetFramework>
55

66
<IsPackable>false</IsPackable>
7-
<ReleaseVersion>1.1.0</ReleaseVersion>
7+
<ReleaseVersion>2.0</ReleaseVersion>
88
</PropertyGroup>
99

1010
<ItemGroup>
@@ -25,6 +25,7 @@
2525
<Compile Remove="EmptyClass.cs" />
2626
<Compile Remove="appSetings.cs" />
2727
<Compile Remove="TestResults\LocaleTest.cs" />
28+
<Compile Remove="LocalTest.cs" />
2829
</ItemGroup>
2930
<ItemGroup>
3031
<None Remove="stack.config" />
@@ -35,8 +36,13 @@
3536
<None Remove="TestResults\_Uttams-MacBook-Pro_2018-09-29_00_07_58.trx" />
3637
<None Remove="TestResults\_Uttams-MacBook-Pro_2018-09-29_19_54_44.trx" />
3738
<None Remove="appSetting.xml" />
39+
<None Remove="appsetting.json" />
3840
</ItemGroup>
3941
<ItemGroup>
4042
<ProjectReference Include="..\ContentStack.Core\Contentstack.Core.csproj" />
43+
<ProjectReference Include="..\Contentstack.AspNetCore\Contentstack.AspNetCore.csproj" />
44+
</ItemGroup>
45+
<ItemGroup>
46+
<Folder Include="Models\" />
4147
</ItemGroup>
4248
</Project>

0 commit comments

Comments
 (0)