Problem with ID of WordItem class

Topics: CAB & Smart Client Software Factory
May 2, 2006 at 1:24 AM
originally posted by: alexsantos

Hi,

I don't know why, but the CompositeUI doesn't set the correct ID. I added this TestCase on project CompositeUI.Tests.NUnit to try.

Please, add it to your sources to see if the error continue...

TestMethod
public void SetWorkItemID()
{
WorkItem parentWorkItem = new TestableRootWorkItem();
WorkItem childWorkItem = parentWorkItem.WorkItems.AddNew<WorkItem>("teste");

Assert.AreEqual(childWorkItem.ID,"teste");
}
May 2, 2006 at 7:37 AM
originally posted by: DLorenz

WorkItem.ID refers to the ID used to save and load WorkItem state. It won't use the key as the value. Personally, after I create the child workitem, I do childWorkItem.ID = key; because the ID that gets assigned is a random GUID otherwise, making it pretty useless since you wouldn't know what the GUID was to pull data back into state unless you store the GUID somewhere else.