コード例 #1
0
ファイル: Receiver.cs プロジェクト: TheLonelyDev/Planning
        // Delete an employee using PlanningLibrary (layered code on google contacts)
        public void deleteEmployee(XmlDocument doc)
        {
            //Parsing data from XmlDocument
            XmlNodeList UUID = doc.GetElementsByTagName("UUID");

            // Logging parsed data
            Console.WriteLine(UUID[0].InnerText);

            // Deleting the Person(employee) to google people/contacts using method from PlanningLibrary
            // Expects a UUID
            Attendee.IdeleteAttendee(UUID[0].InnerText);

            Console.WriteLine("employee successfully deleted");
            ControlRoom.SendConfirmationMessage("Planning: Employee successfully deleted");
        }
コード例 #2
0
        public static void testAttendeeDeleteNotExcistingPerson()
        {
            GService g = new GService();

            try
            {
                // update person with same version = WrongVersionException
                Attendee.IdeleteAttendee("UUIDTESTWrong");
                Console.WriteLine("failed, person deleted");
                Console.ReadKey();
            }
            catch (WrongVersionException)
            {
                Console.WriteLine(" worked!");
                Console.Read();
            }
        }
コード例 #3
0
        //attendee tests:
        // - notExcisting calendar (create, update, delete)
        // - wrong version (update)
        // - duplication uuid/person (create)
        public static void testAttendee()
        {
            GService g          = new GService();
            string   uuid       = "UUIDTEST5234";
            Person   testPerson = makePerson("testName2", "TestLastName", "*****@*****.**");

            Attendee.InewAttendee(testPerson, uuid, "1");
            Console.WriteLine("person created");
            Console.ReadKey();

            // when we update we recieve a full body of a person + UUID
            Person updatePerson = makePerson("newTestName", "TestLastName", "*****@*****.**");

            Attendee.IupdateAttendee(updatePerson, uuid, "2");
            Console.WriteLine("updated person");
            Console.ReadKey();

            Attendee.IdeleteAttendee(uuid);
            Console.WriteLine("deleted person");
            Console.Read();
        }
コード例 #4
0
        public static void testAttendeeWrongVersion()
        {
            GService g          = new GService();
            Person   testPerson = makePerson("testName2", "TestLastName", "*****@*****.**");

            Attendee.InewAttendee(testPerson, "UUIDTEST", "1");
            Console.WriteLine("person created");
            Console.ReadKey();

            try
            {
                // update person with same version = WrongVersionException
                Person updatePerson = makePerson("newTestName", "TestLastName", "*****@*****.**");
                Attendee.IupdateAttendee(updatePerson, "UUIDTEST", "1");
                Console.WriteLine("failed, person updated");
                Console.ReadKey();
            }
            catch (WrongVersionException)
            {
                Attendee.IdeleteAttendee("UUIDTEST");
                Console.WriteLine(" worked! + deleted person");
                Console.Read();
            }
        }
コード例 #5
0
        public static void testAttendeeDuplication()
        {
            GService g          = new GService();
            Person   testPerson = makePerson("testName2", "TestLastName", "*****@*****.**");

            Attendee.InewAttendee(testPerson, "UUIDTEST", "1");
            Console.WriteLine("person created");
            Console.ReadKey();

            try
            {
                // create new person with same UUID = notFoundException
                Person updatePerson = makePerson("newTestName", "TestLastName", "*****@*****.**");
                Attendee.InewAttendee(updatePerson, "UUIDTEST", "1");
                Console.WriteLine("failed: no exception");
                Console.ReadKey();
            }
            catch (NotFoundException)
            {
                Attendee.IdeleteAttendee("UUIDTEST");
                Console.WriteLine(" worked! + deleted person");
                Console.Read();
            }
        }