static void Main(string[] args) { "Testing ItemEditor Package".title('='); Console.WriteLine(); DBEngine <int, DBElement <int, ListOfStrings> > db1 = new DBEngine <int, DBElement <int, ListOfStrings> >(); ItemEditor <int, string> itemEditor = new ItemEditor <int, string>(); "For key = 1, metadata before editing is: ".title('-'); DBElement <int, ListOfStrings> elem1 = new DBElement <int, ListOfStrings>(); elem1.name = "1st Key/Value = Int/ListOfStrings"; elem1.descr = "This is first element of Int/ListOfStrings key value pair."; elem1.timeStamp = DateTime.Now; elem1.children.AddRange(new List <int> { 100, 101, 102, 103, 104, 105 }); elem1.payload = new ListOfStrings(); elem1.payload.theWrappedData = new List <string> { "CSE681", "SMA", "C#.net", "AI" }; db1.insert(1, elem1); db1.showDB(); Console.WriteLine("\n\n"); "For key = 1, metadata after editing is: ".title('-'); itemEditor.editByName(ref db1, 1, "NewX"); itemEditor.editByDescr(ref db1, 1, "NewDescription"); db1.showDB(); Console.WriteLine("\n\n"); }
void TestR4() { " Demonstrating Requirement #4 ".title('='); WriteLine(); "Before edit of Key=2 and Key=4 values.".title('-'); DBElement <int, ListOfStrings> oldElement = db1.Dictionary[2]; oldElement.showElement(); ItemEditor <int, ListOfStrings> itemEditor = new ItemEditor <int, ListOfStrings>(); // Creates a DateTime for the local time. itemEditor.editByName(ref db1, 2, "edited name for key=2"); itemEditor.editByChild(ref db1, 2, new List <int> { 205, 206, 207, 208, 209, 210 }); itemEditor.editByDescr(ref db1, 2, "edited descr for key=2"); DBElement <int, ListOfStrings> newElement123d = db1.Dictionary[2]; newElement123d.showElement(); itemEditor.editPayloadByListOfString(ref db1, 2, new List <string> { "CSE681_2_New", "SMA_2_New", "C#.net_2_New", "AI_2_New" }); DateTime newTime = new DateTime(1990, 6, 15, 0, 0, 0); itemEditor.editByTime(ref db1, 4, newTime); DateTime newTime2 = new DateTime(1990, 6, 16, 0, 0, 0); itemEditor.editByTime(ref db1, 2, newTime2); "After edit of Key = 2 and Key = 4 values.".title('-'); WriteLine(); WriteLine("You can see in updated element, Name,description,children,time and payload attributes are changed."); DBElement <int, ListOfStrings> newElement1 = db1.Dictionary[2]; DBElement <int, ListOfStrings> newElement2 = db1.Dictionary[4]; newElement1.showElement(); newElement2.showElement(); WriteLine(); }