public override void OnDeserialised()
 {
     Schedule = new Schedule()
     {
         Name = Name,
         Url = Url,
         ScheduleInfo = ScheduleInfo,
         Push = Push
     };
 }
示例#2
0
        private static void TestSchedules()
        {
            Console.WriteLine("================ TESTING SCHEDULES ================");
            Console.WriteLine();

            var schedule = new Schedule
            {
                Name = "TEST_SCHEDULE",
                ScheduleInfo = new ScheduleInfo
                {
                    ScheduleTime = DateTime.Now.AddMinutes(5)
                },
                Push = UrbanAirSharpGateway.CreatePush("Scheduled Push")
            };

            Console.WriteLine("CREATE SCHEDULE:");
            var createResponse = _urbanAirSharpGateway.CreateSchedule(schedule);
            Console.Write(createResponse.HttpResponseCode + " - ");
            Console.WriteLine(createResponse.Ok ? "SUCCESS" : "FAILED");
            Console.WriteLine();

            Console.WriteLine("LIST SCHEDULES:");
            var listResponse = _urbanAirSharpGateway.ListSchedules();
            Console.Write(listResponse.HttpResponseCode + " - ");
            Console.WriteLine(listResponse.Ok ? "SUCCESS" : "FAILED");
            Console.WriteLine();

            var scheduleId = Guid.NewGuid();

            if (createResponse.Ok && createResponse.Schedules.Count > 0)
            {
                scheduleId = createResponse.Schedules[0].Id;
            }

            Console.WriteLine("GET SCHEDULE:");
            var getResponse = _urbanAirSharpGateway.GetSchedule(scheduleId);
            Console.Write(getResponse.HttpResponseCode + " - ");
            Console.WriteLine(getResponse.Ok ? "SUCCESS" : "FAILED");
            Console.WriteLine();

            Console.WriteLine("DELETE SCHEDULE:");
            var deleteResponse = _urbanAirSharpGateway.DeleteSchedule(scheduleId);
            Console.Write(deleteResponse.HttpResponseCode + " - ");
            Console.WriteLine(deleteResponse.Ok ? "SUCCESS" : "FAILED");
            Console.WriteLine();
        }