public void GetTemplateByProjectIdTest() { var templateObject = _clientObject.GetTemplatesByProjectId(_configData.ProjectId.ToString()); Assert.IsNotNull(templateObject); CollectionAssert.AllItemsAreUnique(templateObject.ToList()); CollectionAssert.AllItemsAreNotNull(templateObject.ToList()); }
public void GetTemplateByProjectId_InvalidCredential() { var invalidCredential = new GcConnectClient("abc", _configData.Email); var templateObject = invalidCredential.GetTemplatesByProjectId(_configData.TemplateId.ToString()); Assert.IsNull(templateObject); }
private void PopulateForm() { if (_credentialsStore.IsNullOrEmpty()) { Response.Write("<script>alert('Please setup your GatherContent config first!');" + "window.location='/modules/GcEpiPlugin/GatherContentConfigSetup.aspx'</script>"); Visible = false; return; } if (Session["ProjectId"] == null) { Response.Write("<script>alert('Please select the GatherContent Project!');" + "window.location='/modules/GcEpiPlugin/NewGcMappingStep1.aspx'</script>"); Visible = false; return; } _client = new GcConnectClient(_credentialsStore.ToList().First().ApiKey, _credentialsStore.ToList().First().Email); var projectId = Convert.ToInt32(Session["ProjectId"]); projectName.Text = _client.GetProjectById(projectId).Name; var templates = _client.GetTemplatesByProjectId(Session["ProjectId"].ToString()); var mappings = GcDynamicUtilities.RetrieveStore <GcDynamicTemplateMappings>(); var rblTemp = new RadioButtonList(); rblGcTemplates.Items.Clear(); foreach (var template in templates) { if (mappings.Any(mapping => mapping.TemplateId == template.Id.ToString())) { rblTemp.Items.Add(new ListItem($"{template.Name} <a href='/modules/GcEpiPlugin/ReviewItemsForImport.aspx?" + $"TemplateId={template.Id}&ProjectId={projectId}'> " + $"Review Items for Import </a> <br>{template.Description}", template.Id.ToString()) { Enabled = false }); } else { rblGcTemplates.Items.Add(new ListItem(template.Name + "<br>" + template.Description, template.Id.ToString())); } } foreach (ListItem item in rblTemp.Items) { rblGcTemplates.Items.Add(item); } Session["PostType"] = null; Session["Author"] = null; Session["DefaultStatus"] = null; }