I've been working with Coders 4 charities over the weekend and our project was to build a content management site for one of our non profit organizations. I put together a little bit of NUnit code to learn how the lists work and thought I'd share it out. nothing special.
you'll have to copy the telerik element out of the web.config into your app.config.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Telerik.Lists;
using Telerik.Lists.PersistentObjects;
using NUnit.Framework;
using System.Collections;
namespace James.Tests
{
[TestFixture]
public class ListsFixture
{
ListManager lm = new ListManager();
INamedList list;
[SetUp]
public void Setup()
{
list = lm.CreateList("JamesList");
lm.SaveList(list);
Assert.IsNotNull(lm.GetList(list.ID));
}
[TearDown]
public void teardown()
{
lm.DeleteList(lm.GetList(list.ID));
Assert.IsNull(lm.GetList(list.ID));
}
[Test]
public void AddStuffToList()
{
IListItem item = new ListItem();
item.Headline = "James Test Item";
item.Content = "ITEM CONTENT";
item.Parent = list;
list.Items.Add(item);
lm.SaveListItem(item);
INamedList newList = lm.GetList(list.ID);
Assert.AreEqual(1, newList.Items.Count);
}
}
}