From dac841e120cb88a7102f865ac43a63ff96bcc35b Mon Sep 17 00:00:00 2001 From: srajak8 <92512625+srajak8@users.noreply.github.com> Date: Sat, 13 Aug 2022 18:07:33 +0530 Subject: [PATCH 1/3] tests(fpo): added the integration test for FPO Optimizer API Created the integration test for Linked PA Templates API --- .../Api/LinkedPATemplatesApiTest.cs | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 tests/FactSet.AnalyticsAPI.Engines.Test/Api/LinkedPATemplatesApiTest.cs diff --git a/tests/FactSet.AnalyticsAPI.Engines.Test/Api/LinkedPATemplatesApiTest.cs b/tests/FactSet.AnalyticsAPI.Engines.Test/Api/LinkedPATemplatesApiTest.cs new file mode 100644 index 00000000..b32d622f --- /dev/null +++ b/tests/FactSet.AnalyticsAPI.Engines.Test/Api/LinkedPATemplatesApiTest.cs @@ -0,0 +1,131 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading; + +using FactSet.AnalyticsAPI.Engines.Api; +using FactSet.AnalyticsAPI.Engines.Client; +using FactSet.AnalyticsAPI.Engines.Model; +using System.Collections.Generic; +using System.Net; + + +namespace FactSet.AnalyticsAPI.Engines.Test.Api +{ + [TestClass] + public class LinkedPATemplatesApiTest + { + + private LinkedPATemplatesApi linkedPATemplates; + + + [TestInitialize] + public void Init() + { + linkedPATemplates = new LinkedPATemplatesApi(CommonFunctions.BuildConfiguration()); + } + + [TestMethod] + public void Test_CreateLinkedPATemplate() + { + const string directory = "Personal:SDKTests/DoNotModify/LinkedPATemplates/"; + const string parentComponenIid = "801B800245E468A52AEBEC4BE31CFF5AF82F371DAEF5F158AC2E98C2FA324B46"; + const string description = "This is a linked PA template that only returns security level data"; + List mandatory = new List(2); + mandatory.Add("accounts"); + mandatory.Add("benchmarks"); + List optional = new List(2); + optional.Add("groups"); + optional.Add("columns"); + List locked = new List(2); + locked.Add("componentdetail"); + + var content = new TemplateContentTypes(mandatory, optional, locked); + + var linkedPATemplatesParameter = new LinkedPATemplateParameters(directory, parentComponenIid, description, content); + + var linkedPATemplatesParameterRoot = new LinkedPATemplateParametersRoot(linkedPATemplatesParameter); + + ApiResponse response = linkedPATemplates.CreateLinkedPATemplatesWithHttpInfo(linkedPATemplatesParameterRoot); + + Assert.IsTrue(response.StatusCode == HttpStatusCode.Created, "Response should be 201 - Success"); + Assert.IsTrue(response.Data.Data.GetType() == typeof(LinkedPATemplatePostSummary), "Response should be of LinkedPATemplatePostSummary type."); + Assert.IsTrue(response.Data.Data.Id.GetType() == typeof(string), "Response should be of String type."); + Assert.IsTrue(response.Data.Data.Id.Length > 0 , "Response result should not be an empty list."); + + + + } + [TestMethod] + public void Test_GetAllLinkedPATemplate() + { + const string directory = "Personal:SDKTests/DoNotModify/LinkedPATemplates/"; + ApiResponse response = linkedPATemplates.GetLinkedPATemplatesWithHttpInfo(directory); + List templatelist = response.Data.Data.Keys.ToList(); + string firstTemplate = templatelist[0]; + + Assert.IsTrue(response.StatusCode == HttpStatusCode.OK, "Response should be 200 - Success"); + Assert.IsTrue(response.Data.Data.GetType() == typeof(Dictionary), "Response should be of Dictionary type."); + Assert.IsTrue(response.Data.Data[firstTemplate].GetType() == typeof(LinkedPATemplateSummary), "Response should be of LinkedPATemplateSummary type."); + Assert.IsTrue(response.Data.Data.Count > 0, "Response result should not be an empty list."); + + } + [TestMethod] + public void Test_Update_LinkedPA_Templates() + { + const string directory = "Personal:SDKTests/DoNotModify/LinkedPATemplates/"; + const string parentComponentId = "801B800245E468A52AEBEC4BE31CFF5AF82F371DAEF5F158AC2E98C2FA324B46"; + const string description = "This is an updated linked PA template that only returns security level data"; + ApiResponse templates = linkedPATemplates.GetLinkedPATemplatesWithHttpInfo(directory); + List templatesId = templates.Data.Data.Keys.ToList(); + var linkedPATemplateUpdateParameters = new LinkedPATemplateUpdateParameters(parentComponentId, description); + + List mandatory = new List(2); + mandatory.Add("accounts"); + mandatory.Add("benchmarks"); + List optional = new List(2); + optional.Add("groups"); + optional.Add("columns"); + List locked = new List(2); + locked.Add("componentdetail"); + + var content = new TemplateContentTypes(mandatory, optional, locked); + var linkedPATemplateUpdateParametersRoot = new LinkedPATemplateUpdateParametersRoot(linkedPATemplateUpdateParameters); + + ApiResponse response = linkedPATemplates.UpdateLinkedPATemplatesWithHttpInfo(templatesId[0],linkedPATemplateUpdateParametersRoot); + Assert.IsTrue(response.StatusCode == HttpStatusCode.OK, "Response should be 200 - Success"); + Assert.IsTrue(response.Data.Data.GetType() == typeof(LinkedPATemplatePostSummary), "Response should be of LinkedPATemplatePostSummary type."); + Assert.IsTrue(response.Data.Data.Id.Length > 0, "Response result should not be an empty list."); + + } + [TestMethod] + public void Test_GetLinkedPATemplatesById() + + { + const string directory = "Personal:SDKTests/DoNotModify/LinkedPATemplates/"; + + ApiResponse templates = linkedPATemplates.GetLinkedPATemplatesWithHttpInfo(directory); + List templatesId = templates.Data.Data.Keys.ToList(); + ApiResponse response = linkedPATemplates.GetLinkedPATemplatesByIdWithHttpInfo(templatesId[0]); + + Assert.IsTrue(response.StatusCode == HttpStatusCode.OK, "Response should be 200 - Success"); + Assert.IsTrue(response.Data.GetType() == typeof(LinkedPATemplateRoot), "Response should be of LinkedPATemplateRoot type."); + Assert.IsTrue(response.Data.Data.GetType() == typeof(LinkedPATemplate),"Response should be of LinkedPaTemplate type"); + + } + [TestMethod] + public void Test_DeleteLinkedPATemplates() + { + const string directory = "Personal:SDKTests/DoNotModify/LinkedPATemplates/"; + + ApiResponse templates = linkedPATemplates.GetLinkedPATemplatesWithHttpInfo(directory); + List templatesId = templates.Data.Data.Keys.ToList(); + + ApiResponse response = linkedPATemplates.DeleteLinkedPATemplatesWithHttpInfo(templatesId[0]); + Assert.IsTrue(response.StatusCode == HttpStatusCode.NoContent, "Response should be 204 - Success"); + + } + + } +} From 02b018932e4320b522d9d342d76ca84f0a1bb9e9 Mon Sep 17 00:00:00 2001 From: srajak8 <92512625+srajak8@users.noreply.github.com> Date: Sat, 13 Aug 2022 18:15:39 +0530 Subject: [PATCH 2/3] Revert "tests(fpo): added the integration test for FPO Optimizer API" This reverts commit dac841e120cb88a7102f865ac43a63ff96bcc35b. --- .../Api/LinkedPATemplatesApiTest.cs | 131 ------------------ 1 file changed, 131 deletions(-) delete mode 100644 tests/FactSet.AnalyticsAPI.Engines.Test/Api/LinkedPATemplatesApiTest.cs diff --git a/tests/FactSet.AnalyticsAPI.Engines.Test/Api/LinkedPATemplatesApiTest.cs b/tests/FactSet.AnalyticsAPI.Engines.Test/Api/LinkedPATemplatesApiTest.cs deleted file mode 100644 index b32d622f..00000000 --- a/tests/FactSet.AnalyticsAPI.Engines.Test/Api/LinkedPATemplatesApiTest.cs +++ /dev/null @@ -1,131 +0,0 @@ -using Microsoft.VisualStudio.TestTools.UnitTesting; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Threading; - -using FactSet.AnalyticsAPI.Engines.Api; -using FactSet.AnalyticsAPI.Engines.Client; -using FactSet.AnalyticsAPI.Engines.Model; -using System.Collections.Generic; -using System.Net; - - -namespace FactSet.AnalyticsAPI.Engines.Test.Api -{ - [TestClass] - public class LinkedPATemplatesApiTest - { - - private LinkedPATemplatesApi linkedPATemplates; - - - [TestInitialize] - public void Init() - { - linkedPATemplates = new LinkedPATemplatesApi(CommonFunctions.BuildConfiguration()); - } - - [TestMethod] - public void Test_CreateLinkedPATemplate() - { - const string directory = "Personal:SDKTests/DoNotModify/LinkedPATemplates/"; - const string parentComponenIid = "801B800245E468A52AEBEC4BE31CFF5AF82F371DAEF5F158AC2E98C2FA324B46"; - const string description = "This is a linked PA template that only returns security level data"; - List mandatory = new List(2); - mandatory.Add("accounts"); - mandatory.Add("benchmarks"); - List optional = new List(2); - optional.Add("groups"); - optional.Add("columns"); - List locked = new List(2); - locked.Add("componentdetail"); - - var content = new TemplateContentTypes(mandatory, optional, locked); - - var linkedPATemplatesParameter = new LinkedPATemplateParameters(directory, parentComponenIid, description, content); - - var linkedPATemplatesParameterRoot = new LinkedPATemplateParametersRoot(linkedPATemplatesParameter); - - ApiResponse response = linkedPATemplates.CreateLinkedPATemplatesWithHttpInfo(linkedPATemplatesParameterRoot); - - Assert.IsTrue(response.StatusCode == HttpStatusCode.Created, "Response should be 201 - Success"); - Assert.IsTrue(response.Data.Data.GetType() == typeof(LinkedPATemplatePostSummary), "Response should be of LinkedPATemplatePostSummary type."); - Assert.IsTrue(response.Data.Data.Id.GetType() == typeof(string), "Response should be of String type."); - Assert.IsTrue(response.Data.Data.Id.Length > 0 , "Response result should not be an empty list."); - - - - } - [TestMethod] - public void Test_GetAllLinkedPATemplate() - { - const string directory = "Personal:SDKTests/DoNotModify/LinkedPATemplates/"; - ApiResponse response = linkedPATemplates.GetLinkedPATemplatesWithHttpInfo(directory); - List templatelist = response.Data.Data.Keys.ToList(); - string firstTemplate = templatelist[0]; - - Assert.IsTrue(response.StatusCode == HttpStatusCode.OK, "Response should be 200 - Success"); - Assert.IsTrue(response.Data.Data.GetType() == typeof(Dictionary), "Response should be of Dictionary type."); - Assert.IsTrue(response.Data.Data[firstTemplate].GetType() == typeof(LinkedPATemplateSummary), "Response should be of LinkedPATemplateSummary type."); - Assert.IsTrue(response.Data.Data.Count > 0, "Response result should not be an empty list."); - - } - [TestMethod] - public void Test_Update_LinkedPA_Templates() - { - const string directory = "Personal:SDKTests/DoNotModify/LinkedPATemplates/"; - const string parentComponentId = "801B800245E468A52AEBEC4BE31CFF5AF82F371DAEF5F158AC2E98C2FA324B46"; - const string description = "This is an updated linked PA template that only returns security level data"; - ApiResponse templates = linkedPATemplates.GetLinkedPATemplatesWithHttpInfo(directory); - List templatesId = templates.Data.Data.Keys.ToList(); - var linkedPATemplateUpdateParameters = new LinkedPATemplateUpdateParameters(parentComponentId, description); - - List mandatory = new List(2); - mandatory.Add("accounts"); - mandatory.Add("benchmarks"); - List optional = new List(2); - optional.Add("groups"); - optional.Add("columns"); - List locked = new List(2); - locked.Add("componentdetail"); - - var content = new TemplateContentTypes(mandatory, optional, locked); - var linkedPATemplateUpdateParametersRoot = new LinkedPATemplateUpdateParametersRoot(linkedPATemplateUpdateParameters); - - ApiResponse response = linkedPATemplates.UpdateLinkedPATemplatesWithHttpInfo(templatesId[0],linkedPATemplateUpdateParametersRoot); - Assert.IsTrue(response.StatusCode == HttpStatusCode.OK, "Response should be 200 - Success"); - Assert.IsTrue(response.Data.Data.GetType() == typeof(LinkedPATemplatePostSummary), "Response should be of LinkedPATemplatePostSummary type."); - Assert.IsTrue(response.Data.Data.Id.Length > 0, "Response result should not be an empty list."); - - } - [TestMethod] - public void Test_GetLinkedPATemplatesById() - - { - const string directory = "Personal:SDKTests/DoNotModify/LinkedPATemplates/"; - - ApiResponse templates = linkedPATemplates.GetLinkedPATemplatesWithHttpInfo(directory); - List templatesId = templates.Data.Data.Keys.ToList(); - ApiResponse response = linkedPATemplates.GetLinkedPATemplatesByIdWithHttpInfo(templatesId[0]); - - Assert.IsTrue(response.StatusCode == HttpStatusCode.OK, "Response should be 200 - Success"); - Assert.IsTrue(response.Data.GetType() == typeof(LinkedPATemplateRoot), "Response should be of LinkedPATemplateRoot type."); - Assert.IsTrue(response.Data.Data.GetType() == typeof(LinkedPATemplate),"Response should be of LinkedPaTemplate type"); - - } - [TestMethod] - public void Test_DeleteLinkedPATemplates() - { - const string directory = "Personal:SDKTests/DoNotModify/LinkedPATemplates/"; - - ApiResponse templates = linkedPATemplates.GetLinkedPATemplatesWithHttpInfo(directory); - List templatesId = templates.Data.Data.Keys.ToList(); - - ApiResponse response = linkedPATemplates.DeleteLinkedPATemplatesWithHttpInfo(templatesId[0]); - Assert.IsTrue(response.StatusCode == HttpStatusCode.NoContent, "Response should be 204 - Success"); - - } - - } -} From 3a8d00e971cc457e2c95946c0619d2df4288cff7 Mon Sep 17 00:00:00 2001 From: srajak8 <92512625+srajak8@users.noreply.github.com> Date: Sat, 13 Aug 2022 18:28:48 +0530 Subject: [PATCH 3/3] tests(linkedpatemplates): added tests for Linked PA Templates API added the tests for Linked PA Templates API --- .../Api/LinkedPATemplatesApiTest.cs | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) create mode 100644 tests/FactSet.AnalyticsAPI.Engines.Test/Api/LinkedPATemplatesApiTest.cs diff --git a/tests/FactSet.AnalyticsAPI.Engines.Test/Api/LinkedPATemplatesApiTest.cs b/tests/FactSet.AnalyticsAPI.Engines.Test/Api/LinkedPATemplatesApiTest.cs new file mode 100644 index 00000000..b32d622f --- /dev/null +++ b/tests/FactSet.AnalyticsAPI.Engines.Test/Api/LinkedPATemplatesApiTest.cs @@ -0,0 +1,131 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Threading; + +using FactSet.AnalyticsAPI.Engines.Api; +using FactSet.AnalyticsAPI.Engines.Client; +using FactSet.AnalyticsAPI.Engines.Model; +using System.Collections.Generic; +using System.Net; + + +namespace FactSet.AnalyticsAPI.Engines.Test.Api +{ + [TestClass] + public class LinkedPATemplatesApiTest + { + + private LinkedPATemplatesApi linkedPATemplates; + + + [TestInitialize] + public void Init() + { + linkedPATemplates = new LinkedPATemplatesApi(CommonFunctions.BuildConfiguration()); + } + + [TestMethod] + public void Test_CreateLinkedPATemplate() + { + const string directory = "Personal:SDKTests/DoNotModify/LinkedPATemplates/"; + const string parentComponenIid = "801B800245E468A52AEBEC4BE31CFF5AF82F371DAEF5F158AC2E98C2FA324B46"; + const string description = "This is a linked PA template that only returns security level data"; + List mandatory = new List(2); + mandatory.Add("accounts"); + mandatory.Add("benchmarks"); + List optional = new List(2); + optional.Add("groups"); + optional.Add("columns"); + List locked = new List(2); + locked.Add("componentdetail"); + + var content = new TemplateContentTypes(mandatory, optional, locked); + + var linkedPATemplatesParameter = new LinkedPATemplateParameters(directory, parentComponenIid, description, content); + + var linkedPATemplatesParameterRoot = new LinkedPATemplateParametersRoot(linkedPATemplatesParameter); + + ApiResponse response = linkedPATemplates.CreateLinkedPATemplatesWithHttpInfo(linkedPATemplatesParameterRoot); + + Assert.IsTrue(response.StatusCode == HttpStatusCode.Created, "Response should be 201 - Success"); + Assert.IsTrue(response.Data.Data.GetType() == typeof(LinkedPATemplatePostSummary), "Response should be of LinkedPATemplatePostSummary type."); + Assert.IsTrue(response.Data.Data.Id.GetType() == typeof(string), "Response should be of String type."); + Assert.IsTrue(response.Data.Data.Id.Length > 0 , "Response result should not be an empty list."); + + + + } + [TestMethod] + public void Test_GetAllLinkedPATemplate() + { + const string directory = "Personal:SDKTests/DoNotModify/LinkedPATemplates/"; + ApiResponse response = linkedPATemplates.GetLinkedPATemplatesWithHttpInfo(directory); + List templatelist = response.Data.Data.Keys.ToList(); + string firstTemplate = templatelist[0]; + + Assert.IsTrue(response.StatusCode == HttpStatusCode.OK, "Response should be 200 - Success"); + Assert.IsTrue(response.Data.Data.GetType() == typeof(Dictionary), "Response should be of Dictionary type."); + Assert.IsTrue(response.Data.Data[firstTemplate].GetType() == typeof(LinkedPATemplateSummary), "Response should be of LinkedPATemplateSummary type."); + Assert.IsTrue(response.Data.Data.Count > 0, "Response result should not be an empty list."); + + } + [TestMethod] + public void Test_Update_LinkedPA_Templates() + { + const string directory = "Personal:SDKTests/DoNotModify/LinkedPATemplates/"; + const string parentComponentId = "801B800245E468A52AEBEC4BE31CFF5AF82F371DAEF5F158AC2E98C2FA324B46"; + const string description = "This is an updated linked PA template that only returns security level data"; + ApiResponse templates = linkedPATemplates.GetLinkedPATemplatesWithHttpInfo(directory); + List templatesId = templates.Data.Data.Keys.ToList(); + var linkedPATemplateUpdateParameters = new LinkedPATemplateUpdateParameters(parentComponentId, description); + + List mandatory = new List(2); + mandatory.Add("accounts"); + mandatory.Add("benchmarks"); + List optional = new List(2); + optional.Add("groups"); + optional.Add("columns"); + List locked = new List(2); + locked.Add("componentdetail"); + + var content = new TemplateContentTypes(mandatory, optional, locked); + var linkedPATemplateUpdateParametersRoot = new LinkedPATemplateUpdateParametersRoot(linkedPATemplateUpdateParameters); + + ApiResponse response = linkedPATemplates.UpdateLinkedPATemplatesWithHttpInfo(templatesId[0],linkedPATemplateUpdateParametersRoot); + Assert.IsTrue(response.StatusCode == HttpStatusCode.OK, "Response should be 200 - Success"); + Assert.IsTrue(response.Data.Data.GetType() == typeof(LinkedPATemplatePostSummary), "Response should be of LinkedPATemplatePostSummary type."); + Assert.IsTrue(response.Data.Data.Id.Length > 0, "Response result should not be an empty list."); + + } + [TestMethod] + public void Test_GetLinkedPATemplatesById() + + { + const string directory = "Personal:SDKTests/DoNotModify/LinkedPATemplates/"; + + ApiResponse templates = linkedPATemplates.GetLinkedPATemplatesWithHttpInfo(directory); + List templatesId = templates.Data.Data.Keys.ToList(); + ApiResponse response = linkedPATemplates.GetLinkedPATemplatesByIdWithHttpInfo(templatesId[0]); + + Assert.IsTrue(response.StatusCode == HttpStatusCode.OK, "Response should be 200 - Success"); + Assert.IsTrue(response.Data.GetType() == typeof(LinkedPATemplateRoot), "Response should be of LinkedPATemplateRoot type."); + Assert.IsTrue(response.Data.Data.GetType() == typeof(LinkedPATemplate),"Response should be of LinkedPaTemplate type"); + + } + [TestMethod] + public void Test_DeleteLinkedPATemplates() + { + const string directory = "Personal:SDKTests/DoNotModify/LinkedPATemplates/"; + + ApiResponse templates = linkedPATemplates.GetLinkedPATemplatesWithHttpInfo(directory); + List templatesId = templates.Data.Data.Keys.ToList(); + + ApiResponse response = linkedPATemplates.DeleteLinkedPATemplatesWithHttpInfo(templatesId[0]); + Assert.IsTrue(response.StatusCode == HttpStatusCode.NoContent, "Response should be 204 - Success"); + + } + + } +}