Skip to content

Commit 3d5a5bb

Browse files
committed
Fixed the api_version issue
1 parent 3ab70d7 commit 3d5a5bb

File tree

13 files changed

+1246
-47
lines changed

13 files changed

+1246
-47
lines changed

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

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -240,41 +240,7 @@ public void Test007_Should_Query_Nested_Global_Fields()
240240
Assert.AreEqual("nested_global_field_test", nestedGlobalField.Uid);
241241
}
242242

243-
[TestMethod]
244-
[DoNotParallelize]
245-
public void Test007a_Should_Query_Nested_Global_Fields_With_ApiVersion()
246-
{
247-
ContentstackResponse response = _stack.GlobalField(apiVersion: "3.2").Query().Find();
248-
GlobalFieldsModel globalFields = response.OpenTResponse<GlobalFieldsModel>();
249-
var jsonResponse = response.OpenJObjectResponse();
250-
251-
Assert.IsNotNull(response);
252-
Assert.IsNotNull(globalFields);
253-
Assert.IsNotNull(globalFields.Modellings);
254-
Assert.IsTrue(globalFields.Modellings.Count >= 1);
255243

256-
var nestedGlobalField = globalFields.Modellings.Find(gf => gf.Uid == "nested_global_field_test");
257-
Assert.IsNotNull(nestedGlobalField);
258-
Assert.AreEqual("nested_global_field_test", nestedGlobalField.Uid);
259-
260-
// Find the global field reference and check its reference_to from the raw JSON
261-
var globalFieldReference = nestedGlobalField.Schema
262-
.FirstOrDefault(f => f.DataType == "global_field" && f.Uid == "global_field_reference");
263-
264-
Assert.IsNotNull(globalFieldReference);
265-
Assert.AreEqual("global_field", globalFieldReference.DataType);
266-
Assert.AreEqual("global_field_reference", globalFieldReference.Uid);
267-
Assert.AreEqual("Global Field Reference", globalFieldReference.DisplayName);
268-
269-
// Check the reference_to value from the raw JSON
270-
var globalFieldsArray = jsonResponse["global_fields"] as Newtonsoft.Json.Linq.JArray;
271-
var nestedGlobalFieldJson = globalFieldsArray?.FirstOrDefault(gf => gf["uid"]?.ToString() == "nested_global_field_test");
272-
var schemaArray = nestedGlobalFieldJson?["schema"] as Newtonsoft.Json.Linq.JArray;
273-
var globalFieldRefJson = schemaArray?.FirstOrDefault(f => f["uid"]?.ToString() == "global_field_reference");
274-
var referenceTo = globalFieldRefJson?["reference_to"]?.ToString();
275-
276-
Assert.AreEqual("referenced_global_field", referenceTo);
277-
}
278244

279245
[TestMethod]
280246
[DoNotParallelize]
@@ -296,6 +262,5 @@ public void Test008_Should_Delete_Nested_Global_Field()
296262
Assert.IsNotNull(response);
297263
}
298264

299-
300265
}
301266
}

0 commit comments

Comments
 (0)