Skip to content

Commit 74b6fe2

Browse files
authored
Merge pull request #88 from contentstack/feat/apiVersion
feat: Added ApiVersion for global field to fetch the nested ones and clean the header after the fetch
2 parents d5b673c + 3d5a5bb commit 74b6fe2

File tree

21 files changed

+2466
-45
lines changed

21 files changed

+2466
-45
lines changed

Contentstack.Management.Core.Tests/IntegrationTest/Contentstack011_GlobalFieldTest.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,19 @@ public void Test006_Should_Query_Global_Field()
107107

108108
[TestMethod]
109109
[DoNotParallelize]
110-
public async System.Threading.Tasks.Task Test007_Should_Update_Async_Global_Field()
110+
public void Test006a_Should_Query_Global_Field_With_ApiVersion()
111+
{
112+
ContentstackResponse response = _stack.GlobalField(apiVersion: "3.2").Query().Find();
113+
GlobalFieldsModel globalField = response.OpenTResponse<GlobalFieldsModel>();
114+
Assert.IsNotNull(response);
115+
Assert.IsNotNull(globalField);
116+
Assert.IsNotNull(globalField.Modellings);
117+
Assert.AreEqual(1, globalField.Modellings.Count);
118+
}
119+
120+
[TestMethod]
121+
[DoNotParallelize]
122+
public async System.Threading.Tasks.Task Test007_Should_Query_Async_Global_Field()
111123
{
112124
ContentstackResponse response = await _stack.GlobalField().Query().FindAsync();
113125
GlobalFieldsModel globalField = response.OpenTResponse<GlobalFieldsModel>();
@@ -116,5 +128,17 @@ public async System.Threading.Tasks.Task Test007_Should_Update_Async_Global_Fiel
116128
Assert.IsNotNull(globalField.Modellings);
117129
Assert.AreEqual(1, globalField.Modellings.Count);
118130
}
131+
132+
[TestMethod]
133+
[DoNotParallelize]
134+
public async System.Threading.Tasks.Task Test007a_Should_Query_Async_Global_Field_With_ApiVersion()
135+
{
136+
ContentstackResponse response = await _stack.GlobalField(apiVersion: "3.2").Query().FindAsync();
137+
GlobalFieldsModel globalField = response.OpenTResponse<GlobalFieldsModel>();
138+
Assert.IsNotNull(response);
139+
Assert.IsNotNull(globalField);
140+
Assert.IsNotNull(globalField.Modellings);
141+
Assert.AreEqual(1, globalField.Modellings.Count);
142+
}
119143
}
120144
}

Contentstack.Management.Core.Tests/IntegrationTest/Contentstack012_NestedGlobalFieldTest.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.IO;
4+
using System.Linq;
45
using System.Threading.Tasks;
56
using AutoFixture;
67
using Contentstack.Management.Core.Models;
@@ -239,6 +240,8 @@ public void Test007_Should_Query_Nested_Global_Fields()
239240
Assert.AreEqual("nested_global_field_test", nestedGlobalField.Uid);
240241
}
241242

243+
244+
242245
[TestMethod]
243246
[DoNotParallelize]
244247
public void Test009_Should_Delete_Referenced_Global_Field()
@@ -259,6 +262,5 @@ public void Test008_Should_Delete_Nested_Global_Field()
259262
Assert.IsNotNull(response);
260263
}
261264

262-
263265
}
264266
}

0 commit comments

Comments
 (0)