public void TestRemoveZeroListID() { var result = ListQueries.RemoveList(0); Assert.AreEqual(false, result); Assert.AreEqual(2, ListQueries.GetLists().Count); }
public string GetHelpContentFromSharePoint(string heading, string sPContext, string helpListName, string templateName) { if (!string.IsNullOrEmpty(heading)) { heading = heading.Replace("\r", string.Empty).Trim(); var query = ListQueries.HelpGetItemQuery(templateName, heading); var helpList = ListFactory.Create(helpListName, query); var presenter = new SharePointListPresenter(helpList, this); var fitem = presenter.GetHelpItems().FirstOrDefault(); if (fitem != null) { return(fitem.GetFieldValue(Constants.SharePointFields.Content)); } var generalHelp = ListQueries.HelpGetItemQuery(templateName, Constants.SharePointFields.WizardHelp); helpList.UpdateCamlQuery(generalHelp); var gitem = presenter.GetHelpItems().FirstOrDefault(); return(gitem != null ? gitem.GetFieldValue(Constants.SharePointFields.Content) : "Unable to find the help content for this document"); } return("Unable to find the help content for this document"); }
public void TestGetAllLists() { var lists = ListQueries.GetLists(); Assert.IsNotNull(lists); Assert.AreEqual(2, lists.Count); }
public void TestAddListToDBNoItems() { var listName = "Test List 4"; var lists = new List <LAList> { new LAList { Name = listName } }; ListQueries.AddList(lists[0]); var result = ListQueries.GetList(3); Assert.IsNotNull(result); Assert.AreEqual(result.LAListItems.Count, 0, "Number of list items is not 0"); var findResult = ListQueries.GetList(3); Assert.IsNotNull(findResult); Assert.AreEqual <string>("Test List 4", findResult.Name); ListQueries.RemoveList(findResult.ID); Assert.AreEqual(2, ListQueries.GetLists().Count); }
public void TestAddListWithItems() { var newList = new LAList() { Name = "List with items" }; newList.LAListItems.Add(new LAListItem() { Description = "Test Item 1", Done = true }); newList.LAListItems.Add(new LAListItem() { Description = "Test Item 2", Done = false }); var result = ListQueries.AddList(newList); Assert.AreEqual(true, result); Assert.AreEqual(3, ListQueries.GetLists().Count); Assert.IsNotNull(newList); Assert.AreEqual(2, newList.LAListItems.Count); ListQueries.RemoveList(newList.ID); Assert.AreEqual(2, ListQueries.GetLists().Count); }
public void TestRemoveNonExistingList() { var result = ListQueries.RemoveList(99); Assert.AreEqual(false, result); Assert.AreEqual(2, ListQueries.GetLists().Count); }
public void TestAddListItem() { LAList testList = new LAList() { Name = "List to Remove" }; ListQueries.AddList(testList); Assert.IsNotNull(ListQueries.GetList(testList.ID)); Assert.AreEqual(0, ListQueries.GetList(testList.ID).LAListItems.Count); var newItem = new LAListItem() { Description = "Test Item", Done = true, ListID = testList.ID }; var result = ListQueries.AddItemToList(newItem); var foundList = ListQueries.GetList(testList.ID); Assert.AreEqual(true, result); Assert.IsNotNull(foundList); Assert.AreEqual(1, foundList.LAListItems.Count); ListQueries.RemoveList(foundList.ID); Assert.AreEqual(2, ListQueries.GetLists().Count); }
public void AddListWithNullName() { var newList = new LAList(); var result = ListQueries.AddList(newList); Assert.AreEqual(false, result); Assert.AreEqual(2, ListQueries.GetLists().Count); }
protected IManualClaimsProcedure LoadClaimsProcedure(string contextUrl, string listName, string title) { var list = ListFactory.Create(listName, ListQueries.GetItemByPolicyTypeQuery(title)); var presenter = new SharePointListPresenter(list, this); var t = presenter.GetManualClaimsProcedure(); return((t != null && t.Count > 0) ? t[0] : null); }
protected IQuestionClass LoadSchedule(string contextUrl, string listName, string title) { var list = ListFactory.Create(listName, ListQueries.GetItemByTitleQuery(title)); var presenter = new SharePointListPresenter(list, this); var t = presenter.GetPreRenewalQuestionaireQuestions(); return((t != null && t.Count > 0) ? t[0] : null); }
public void TestGetSingleList() { var list = ListQueries.GetList(1); Assert.IsNotNull(list); Assert.AreEqual(1, list.ID); Assert.AreEqual(true, list.Name.Equals("Groceries")); Assert.AreEqual(4, list.LAListItems.Count); }
public async Task <List <QueryModel> > Handle(ListQueries message, CancellationToken cancellationToken) { return((await repository .Query .Where(q => q.UserId == message.UserId) .ToListAsync()) .Select(m => queryService.Get(m)) .ToList()); }
public void TestAddItemToNoList() { var newItem = new LAListItem() { Description = "Test Insert 0", Done = false }; var result = ListQueries.AddItemToList(newItem); Assert.AreEqual(false, result); }
public void TestRemoveItemBadId() { LAList testList = ListQueries.GetList(1); var itemCount = testList.LAListItems.Count; var result = ListQueries.DeleteItemFromList(-99); testList = ListQueries.GetList(1); Assert.AreEqual(-1, result); Assert.AreEqual(itemCount, testList.LAListItems.Count); }
public void AddDuplicateList() { var newList = new LAList() { Name = "Groceries" }; var result = ListQueries.AddList(newList); Assert.AreEqual(false, result); Assert.AreEqual(2, ListQueries.GetLists().Count); }
public void TestAddDuplicateItem() { var newItem = new LAListItem() { Description = "Milk", ListID = 1 }; var result = ListQueries.AddItemToList(newItem); Assert.AreEqual(false, result); Assert.AreEqual(4, ListQueries.GetList(1).LAListItems.Count); }
public void TestUpdateListNameNull() { LAList testList = ListQueries.GetList(1); Assert.IsNotNull(testList); testList.Name = null; var result = ListQueries.UpdateList(testList); testList = ListQueries.GetList(1); testList.Name = "Groceries"; Assert.AreEqual(false, result); Assert.IsNotNull(testList); Assert.AreEqual("Groceries", testList.Name); }
public void TestUpdateListAddNullItems() { LAList testList = ListQueries.GetList(1); Assert.IsNotNull(testList); testList.LAListItems.Add(null); var result = ListQueries.UpdateList(testList); testList = null; testList = ListQueries.GetList(1); Assert.AreEqual(true, result); Assert.IsNotNull(testList); Assert.AreEqual("Groceries", testList.Name); Assert.AreEqual(4, testList.LAListItems.Count); }
public void TestRemoveList() { LAList testList = new LAList() { Name = "List to Remove" }; ListQueries.AddList(testList); var findList = ListQueries.GetList(testList.ID); Assert.IsNotNull(findList, "Test List not found."); Assert.AreEqual <string>("List to Remove", findList.Name); var result = ListQueries.RemoveList(findList.ID); Assert.AreEqual(true, result); Assert.IsNull(ListQueries.GetList(3), "List 3 not removed."); }
public void TestRemoveListItem() { LAList testList = ListQueries.GetList(1); Assert.IsNotNull(testList); Assert.IsTrue(ListQueries.AddItemToList(new LAListItem() { Description = "Bread", ListID = 1 })); testList = ListQueries.GetList(1); Assert.IsNotNull(testList); Assert.AreEqual(5, testList.LAListItems.Count); var result = ListQueries.DeleteItemFromList(testList.LAListItems[4].ID); testList = ListQueries.GetList(1); Assert.IsNotNull(testList); Assert.AreEqual(1, result); Assert.AreEqual(4, testList.LAListItems.Count); }
public void TestUpdateListName() { LAList testList = ListQueries.GetList(1); Assert.IsNotNull(testList); testList.Name = "Updated Name"; var result = ListQueries.UpdateList(testList); testList = ListQueries.GetList(1); Assert.AreEqual(true, result); Assert.AreEqual("Updated Name", testList.Name); Assert.AreEqual(4, testList.LAListItems.Count); testList.Name = "Groceries"; var restoreName = ListQueries.UpdateList(testList); testList = ListQueries.GetList(1); Assert.AreEqual(true, restoreName); Assert.AreEqual("Groceries", testList.Name); }
public ListItemsController() { this.listQueries = new ListQueries(); }
private void GetFragements() { _availableAttachments = new Dictionary <string, DocumentFragment>(); List <ISharePointListItem> fragments = null; if (Cache.Contains(Constants.CacheNames.QuoteSlipFragments)) { fragments = (List <ISharePointListItem>)Cache.Get(Constants.CacheNames.QuoteSlipFragments); } else { var list = ListFactory.Create(Settings.Default.GeneralFragmentsListName, ListQueries.FactFinderFragmentsByKey()); var presenter = new SharePointListPresenter(list, this); fragments = presenter.GetItems(); } foreach (var i in fragments) { var key = i.GetFieldValue("Key"); var txtTitle = i.Title + " " + i.GetFieldValue("OAMPS_x0020_Version"); switch (key) { case Constants.FragmentKeys.FinancialServicesGuide: { chkFSG.Text = txtTitle; _availableAttachments.Add(key, new DocumentFragment { Title = txtTitle, Key = key, Url = Settings.Default.FragmentFSG, Locked = i.GetFieldValue("Locked") }); break; } case Constants.FragmentKeys.GeneralAdviceWarning: { _availableAttachments.Add(key, new DocumentFragment { Title = txtTitle, Key = key, Url = Settings.Default.FragmentWarning, Locked = i.GetFieldValue("Locked") }); break; } case Constants.FragmentKeys.PrivacyStatement: { _availableAttachments.Add(key, new DocumentFragment { Title = txtTitle, Key = key, Url = Settings.Default.FragmentPrivacy, Locked = i.GetFieldValue("Locked") }); break; } case Constants.FragmentKeys.StatutoryNotices: { chkSatutory.Text = txtTitle; _availableAttachments.Add(key, new DocumentFragment { Title = txtTitle, Key = key, Url = Settings.Default.FragmentStatutory, Locked = i.GetFieldValue("Locked") }); break; } case Constants.FragmentKeys.UninsuredRisksReviewList: { _availableAttachments.Add(key, new DocumentFragment { Title = txtTitle, Key = key, Url = Settings.Default.FragmentUninsuredRisks, Locked = i.GetFieldValue("Locked") }); break; } } } }
public void TestAddNullItem() { var result = ListQueries.AddItemToList(null); Assert.AreEqual(false, result); }
public void TestInitialize() { Database.SetInitializer(new DbInitializer()); this.db = new ListAssistContext(new DbConStringBuilder("WebAPITests").getConnectionString()); db.Database.Initialize(true); Assert.IsNotNull(this.db, "List assist context is null."); AutoMapperConfiguration.Configure(); listQueries = new ListQueries(new DbConStringBuilder("WebAPITests").getConnectionString()); LAList testList1 = new LAList() { Name = "Test List 1" }; LAList testList2 = new LAList() { Name = "Test List 2" }; LAListItem testInsertItem1 = new LAListItem() { Description = "Test Insert 1", Done = false }; LAListItem testInsertItem2 = new LAListItem() { Description = "Test Insert 2", Done = false }; LAListItem testInsertItem3 = new LAListItem() { Description = "Test Insert 3", Done = false }; Assert.IsNotNull(testList1, "Test list 1 is null."); Assert.IsNotNull(testList2, "Test list 2 is null."); Assert.IsNotNull(testInsertItem1, "Test insert item 1 is null."); testList1.LAListItems.Add(testInsertItem1); Assert.IsNotNull(testInsertItem2, "Test insert item 2 is null."); testList1.LAListItems.Add(testInsertItem2); Assert.IsNotNull(testInsertItem3, "Test insert item 3 is null,"); testList2.LAListItems.Add(testInsertItem3); var lists = new List <LAList> { testList1, testList2, }; foreach (LAList newList in lists) { this.db.LALists.Add(newList); foreach (LAListItem newListItem in newList.LAListItems) { this.db.LAListItems.Add(newListItem); } } this.db.SaveChanges(); Assert.IsNotNull(this.db.LALists.Where(e => e.Name.Equals("Test List 1")).FirstOrDefault(), "Test List 1 not found."); Assert.IsNotNull(this.db.LALists.Where(e => e.Name.Equals("Test List 2")).FirstOrDefault(), "Test List 2 not found."); Assert.IsNull(this.db.LALists.Where(e => e.Name.Equals("Test List 3")).FirstOrDefault(), "Test List 3 found."); }
public void TestGetListZeroListID() { var list = ListQueries.GetList(0); Assert.AreEqual(null, list); }
public void TestGetListBadListID() { var list = ListQueries.GetList(-99); Assert.AreEqual(null, list); }
public void TestGetNonExistantList() { var list = ListQueries.GetList(99); Assert.AreEqual(null, list); }