Skip to content

Commit 3f383a5

Browse files
committed
- Fixed integration test that was failing due to shifting calendar.
1 parent b6667f7 commit 3f383a5

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

Rock.Tests.Integration/Core/Lava/EventScheduledInstanceCommandTests.cs

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,29 @@ public void EventScheduledInstanceCommand_WithDateRangeInMonths_ReturnsExpectedE
165165
{
166166
var effectiveDate = EventsDataManager.Instance.GetDefaultEffectiveDate();
167167

168-
// Get the first Wednesday of the month, then the next two Wednesdays 4 weeks apart.
169-
var date1 = effectiveDate.GetNextWeekday( DayOfWeek.Wednesday );
170-
171-
var date2 = date1.AddDays( 12 * 7 );
168+
// Get the first Wednesday of the month, then every other wednesday
169+
// until we hit the cutoff date of 3 months.
170+
var initialDate = effectiveDate.GetNextWeekday( DayOfWeek.Wednesday );
171+
var validDates = new List<DateTime>();
172+
var invalidDates = new List<DateTime>();
172173

173-
// Staff Meeting recurs every 2 weeks, so our date range of 3 months should not include the first meeting in month 4.
174-
var dateInvalid = RockDateTime.New( date1.Year, date1.Month, 1 ).Value.AddMonths( 3 ).GetNextWeekday( DayOfWeek.Wednesday );
174+
for ( var date = initialDate; ; date = date.AddDays( 14 ) )
175+
{
176+
if ( date < effectiveDate.AddMonths( 3 ) )
177+
{
178+
validDates.Add( date );
179+
}
180+
else
181+
{
182+
invalidDates.Add( date );
183+
break;
184+
}
185+
}
175186

176187
AssertTestEventOccurrences( effectiveDate: null,
177188
"3m",
178-
validDateList: new List<DateTime> { date1, date2 },
179-
invalidDateList: new List<DateTime> { dateInvalid } );
189+
validDateList: validDates,
190+
invalidDateList: invalidDates );
180191
}
181192

182193
[TestMethod]

0 commit comments

Comments
 (0)