コード例 #1
0
        void TestR4()
        {
            WriteLine();
            "Demonstrating Requirement #4".title();

            DBElement <int, string> elem = new DBElement <int, string>();                            //Populating DBEngine

            elem.name      = "Element2";                                                             //object db
            elem.descr     = "test element2";                                                        //for testing data int and string type.
            elem.timeStamp = DateTime.Now;
            elem.children.AddRange(new List <int> {
            });
            elem.payload = "Varun";
            db.insert(1, elem);

            DBElement <int, List <string> > elemPayload2 = new DBElement <int, List <string> >();   //Populating DBEngine

            elemPayload2.name      = "Element5";                                                    //object dbPay
            elemPayload2.descr     = "test element5";                                               //for testing data int and list of string type.
            elemPayload2.timeStamp = DateTime.Now;
            elemPayload2.children.AddRange(new List <int> {
                98, 22, 35
            });
            elemPayload2.payload = new List <string>();
            elemPayload2.payload.AddRange(new List <string> {
                "we", "rock", "the", "world"
            });
            dbPay.insert(2, elemPayload2);

            WriteLine();
            WriteLine("\nUpdating Name of Key 1");
            itemEdit.edit(1, "name", "updated", db);           // editing name
            db.showDB();

            WriteLine();
            WriteLine("\nUpdating description of Key 1");
            itemEdit.edit(1, "descr", "updated", dbPay);        // editing description
            dbPay.showEnumerableDB();

            WriteLine();
            WriteLine("\nUpdating childern of Key 1");
            List <int> child = new List <int> {
                3, 2, 1
            };

            itemEdit.editChildern(1, "childern", child, db);    // editing children
            db.showDB();
            WriteLine();

            WriteLine();
            WriteLine("\nUpdating Payload of Key 'Thug3'");
            List <string> payEdit = new List <string> {
                "Updated", "the", "payload !"
            };

            itemEdit2.editPayload("Thug3", "payload", payEdit, dbString);               // editing payload
            dbString.showEnumerableDB();
            WriteLine();
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            "Testing Item Editor Package".title('=');
            Console.WriteLine();
            DBEngine <int, DBElement <int, List <string> > > dbPay = new DBEngine <int, DBElement <int, List <string> > >();

            DBElement <int, List <string> > elemPayload = new DBElement <int, List <string> >();

            elemPayload.name      = "Element4";
            elemPayload.descr     = "test element4";
            elemPayload.timeStamp = DateTime.Now;
            elemPayload.children.AddRange(new List <int> {
                1, 2, 3
            });
            elemPayload.payload = new List <string>();
            elemPayload.payload.AddRange(new List <string> {
                "Project 2", " ", "demo", " ", "starts"
            });
            //elem.showElement();
            dbPay.insert(4, elemPayload);

            DBElement <int, List <string> > elemPayload2 = new DBElement <int, List <string> >();

            elemPayload2.name      = "Element5";
            elemPayload2.descr     = "test element5";
            elemPayload2.timeStamp = DateTime.Now;
            elemPayload2.children.AddRange(new List <int> {
                98, 22, 35
            });
            elemPayload2.payload = new List <string>();
            elemPayload2.payload.AddRange(new List <string> {
                "we", "rock", "the", "world"
            });
            //elem.showElement();
            dbPay.insert(5, elemPayload2);

            dbPay.showEnumerableDB();
            Console.WriteLine();

            ItemEditor <int, string> itemEdit = new ItemEditor <int, string>();

            itemEdit.edit(4, "name", "updated", dbPay);
            itemEdit.edit(4, "descr", "updated", dbPay);
            List <int> child = new List <int> {
                3, 2, 1
            };

            itemEdit.editChildern(4, "childern", child, dbPay);

            List <string> payLoad = new List <string> {
                "Update", " ", "demo", " ", "starts"
            };

            itemEdit.editPayload(4, "pay-load", payLoad, dbPay);

            dbPay.showEnumerableDB();
        }