Skip to content

Commit 2705f1f

Browse files
committed
ci: ♻️ update test
1 parent fdecf68 commit 2705f1f

File tree

2 files changed

+15
-5
lines changed
  • Contentstack.Management.Core.Unit.Tests/Models
  • Contentstack.Management.Core/Queryable

2 files changed

+15
-5
lines changed

Contentstack.Management.Core.Unit.Tests/Models/AssetTest.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ public async System.Threading.Tasks.Task Should_Create_Asset_Async()
7979
[TestMethod]
8080
public void Should_Query_Asset()
8181
{
82-
ContentstackResponse response = _stack.Asset().Query().Find();
82+
ParameterCollection collection = new ParameterCollection();
83+
84+
collection.Add("limit", 10);
85+
ContentstackResponse response = _stack.Asset().Query().Find(collection);
8386

8487
Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse());
8588
Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString());

Contentstack.Management.Core/Queryable/Query.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,14 @@ public ContentstackResponse Find(ParameterCollection collection = null)
8484
{
8585
_stack.client.ThrowIfNotLoggedIn();
8686
this.ThrowIfAPIKeyEmpty();
87-
foreach (var kvp in collection)
87+
if (collection != null)
8888
{
89-
_collection.Add(kvp.Key, kvp.Value);
89+
foreach (var kvp in collection)
90+
{
91+
_collection.Add(kvp.Key, kvp.Value);
92+
}
9093
}
94+
9195
var service = new QueryService(_stack, _collection, _resourcePath);
9296
return _stack.client.InvokeSync(service);
9397
}
@@ -100,9 +104,12 @@ public Task<ContentstackResponse> FindAsync(ParameterCollection collection = nul
100104
{
101105
_stack.client.ThrowIfNotLoggedIn();
102106
this.ThrowIfAPIKeyEmpty();
103-
foreach (var kvp in collection)
107+
if (collection != null)
104108
{
105-
_collection.Add(kvp.Key, kvp.Value);
109+
foreach (var kvp in collection)
110+
{
111+
_collection.Add(kvp.Key, kvp.Value);
112+
}
106113
}
107114
var service = new QueryService(_stack, _collection, _resourcePath);
108115

0 commit comments

Comments
 (0)