public void CanCreateUpdateDeleteSchedule() { using (var undoContext = UndoContext.Current) { undoContext.Start(); using (AutomationTestBase _testFixture = new AutomationTestBase()) { var scheduleName = TestUtilities.GenerateName("hourlySche"); var startTime = DateTimeOffset.Now.AddMinutes(30); var expiryTime = startTime.AddDays(5); Schedule schedule = _testFixture.CreateHourlySchedule(scheduleName, startTime, expiryTime); Assert.NotNull(schedule); schedule = _testFixture.GetSchedule(schedule.Name); Assert.NotNull(schedule); Assert.Equal((byte)1, schedule.Properties.Interval); Assert.Equal(ScheduleFrequency.Hour.ToString(), schedule.Properties.Frequency); schedule.Properties.IsEnabled = false; schedule.Properties.Description = "hourly schedule"; _testFixture.UpdateSchedule(schedule); var updatedSchedule = _testFixture.GetSchedule(schedule.Name); Assert.False(updatedSchedule.Properties.IsEnabled); Assert.Equal(schedule.Properties.Description, updatedSchedule.Properties.Description); _testFixture.DeleteSchedule(schedule.Name); Assert.Throws <CloudException>(() => { schedule = _testFixture.GetSchedule(schedule.Name); }); } } }
public void CanCreateUpdateDeleteSchedule() { using (var undoContext = UndoContext.Current) { undoContext.Start(); using (AutomationTestBase _testFixture = new AutomationTestBase()) { var scheduleName = TestUtilities.GenerateName("hourlySche"); var startTime = DateTimeOffset.Now.AddMinutes(30); var expiryTime = startTime.AddDays(5); Schedule schedule = _testFixture.CreateHourlySchedule(scheduleName, startTime, expiryTime); Assert.NotNull(schedule); schedule = _testFixture.GetSchedule(schedule.Name); Assert.NotNull(schedule); Assert.Equal((byte)1, schedule.Properties.Interval); Assert.Equal(ScheduleFrequency.Hour.ToString(), schedule.Properties.Frequency); schedule.Properties.IsEnabled = false; schedule.Properties.Description = "hourly schedule"; _testFixture.UpdateSchedule(schedule); var updatedSchedule = _testFixture.GetSchedule(schedule.Name); Assert.False(updatedSchedule.Properties.IsEnabled); Assert.Equal(schedule.Properties.Description, updatedSchedule.Properties.Description); _testFixture.DeleteSchedule(schedule.Name); Assert.Throws<CloudException>(() => { schedule = _testFixture.GetSchedule(schedule.Name); }); } } }