Skip to content

Commit e6d47ef

Browse files
committed
test: add test cases for References and ReferencesAsync
1 parent 4d3952a commit e6d47ef

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public void Initialize_Asset()
4141
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => Asset.PublishAsync(_fixture.Create<PublishUnpublishDetails>()));
4242
Assert.ThrowsException<InvalidOperationException>(() => Asset.Unpublish(_fixture.Create<PublishUnpublishDetails>()));
4343
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => Asset.UnpublishAsync(_fixture.Create<PublishUnpublishDetails>()));
44+
Assert.ThrowsException<InvalidOperationException>(() => Asset.References());
45+
Assert.ThrowsExceptionAsync<InvalidOperationException>(() => Asset.ReferencesAsync());
4446
Assert.AreEqual(Asset.Query().GetType(), typeof(Query));
4547
}
4648

@@ -186,5 +188,23 @@ public async System.Threading.Tasks.Task Should_Unpublish_Asset_Async()
186188
Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse());
187189
Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString());
188190
}
191+
192+
[TestMethod]
193+
public void Should_Get_References_Asset()
194+
{
195+
ContentstackResponse response = _stack.Asset(_fixture.Create<string>()).References();
196+
197+
Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse());
198+
Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString());
199+
}
200+
201+
[TestMethod]
202+
public async System.Threading.Tasks.Task Should_Get_References_Asset_Async()
203+
{
204+
ContentstackResponse response = await _stack.Asset(_fixture.Create<string>()).ReferencesAsync();
205+
206+
Assert.AreEqual(_contentstackResponse.OpenResponse(), response.OpenResponse());
207+
Assert.AreEqual(_contentstackResponse.OpenJObjectResponse().ToString(), response.OpenJObjectResponse().ToString());
208+
}
189209
}
190210
}

0 commit comments

Comments
 (0)