Esempio n. 1
0
        static void Main(string[] args)
        {
            GService   t = new GService();
            Calendarss c = new Calendarss();

            Calendarss.newCalendar("testName", "testloc", "testDes");
            Console.Read();
        }
Esempio n. 2
0
        public static void testEvent()
        {
            GService g = new GService();
            // these always need to be changed before testing
            string uuid         = "UUIDTESTefefERezfzesefeKE12&";
            string uuid2        = "efeefefe";
            string uuid3        = "efefefefefef";
            string calendarName = "test12345634567VIJF";
            Person testPerson   = makePerson("testName2", "TestLastName", "*****@*****.**");

            Attendee.InewAttendee(testPerson, uuid, "1");
            IList <EventAttendee> attendees = new List <EventAttendee>();
            EventAttendee         test      = new EventAttendee()
            {
                //Email = "testname2",
                DisplayName = "*****@*****.**"
            };

            IList <string> UUIDS = new List <string>();

            UUIDS.Add(testPerson.UserDefined[0].Value);

            Console.WriteLine("attendee created");
            Console.ReadKey();

            //create event
            //create calendar
            var testCalendar = Calendarss.InewCalendar(makeCalendar(calendarName), uuid3, "1");

            DateTime start = new DateTime(2019, 5, 7, 14, 30, 0);
            DateTime end   = new DateTime(2019, 5, 7, 15, 30, 0);

            Google.Apis.Calendar.v3.Data.Event ev = makeEvent("1223432123HG23F2V32H2", "tesstlocation", "testDisc", start, end, convertPersonToAttendee(UUIDS));
            Eventss.InewEvent(ev, uuid3, uuid2, "1");
            Console.WriteLine("event created");
            Console.ReadKey();

            //update event
            ev.Summary = "newTestsSummery";

            Eventss.IupdateEventById(ev, uuid3, uuid2, "2");
            Console.WriteLine("event updated");
            Console.ReadKey();

            //delete event
            Eventss.IDeleteEventById(uuid2, uuid3);
            Calendarss.IdeleteCalendarById(uuid3);
            Console.WriteLine("event deleted");
            Console.ReadKey();
        }
Esempio n. 3
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();
            }
        }
Esempio n. 4
0
        public static void testAttendeeUpdateNotExcistingPerson()
        {
            GService g = new GService();

            try
            {
                // update person with same version = WrongVersionException
                Person updatePerson = makePerson("newTestName", "TestLastName", "*****@*****.**");
                Attendee.IupdateAttendee(updatePerson, "UUIDTESTWrong", "1");
                Console.WriteLine("failed, person updated");
                Console.ReadKey();
            }
            catch (WrongVersionException)
            {
                Console.WriteLine(" worked!");
                Console.Read();
            }
        }
Esempio n. 5
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();
        }
Esempio n. 6
0
        public static void testCalendar()
        {
            GService g    = new GService();
            string   uuid = "testUUID3";
            //create calendar
            //!ALways change the UUID!
            var testCalendar = Calendarss.InewCalendar(makeCalendar("calTest"), uuid, "1");

            Console.WriteLine("calendar created");
            Console.ReadKey();

            //update Calendar
            testCalendar.Summary = "updateCalTest";
            Calendarss.IupdateCalendarById(testCalendar, uuid, "2");
            Console.WriteLine("calendar updated");
            Console.ReadKey();

            //delete Calendar
            Calendarss.IdeleteCalendarById(uuid);
            Console.WriteLine("calendar deleted");
            Console.ReadKey();
        }
Esempio n. 7
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();
            }
        }
Esempio n. 8
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();
            }
        }