/// <summary> /// Gets the store. /// </summary> /// <param name="event">The event.</param> /// <returns>MonthStore.</returns> private MonthStore GetStore(IYearlyRecurringEvent @event) { @event.Should().NotBeNull(); var month = (int)@event.EarliestOccurrenceMonth - 1; month.Should().BeInRange(0, 11); return(_eventsByMonth[month]); }
/// <summary> /// Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1"></see>. /// </summary> /// <param name="item">The object to add to the <see cref="T:System.Collections.Generic.ICollection`1"></see>.</param> /// <exception cref="NotImplementedException"></exception> public void Add(IYearlyRecurringEvent item) { var store = GetStore(item); store.Should().NotBeNull(); if (store.Add(item)) { ++Count; } }
/// <summary> /// Removes the first occurrence of a specific object from the /// <see cref="T:System.Collections.Generic.ICollection`1"></see>. /// </summary> /// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1"></see>.</param> /// <returns> /// true if <paramref name="item">item</paramref> was successfully removed from the /// <see cref="T:System.Collections.Generic.ICollection`1"></see>; otherwise, false. This method also returns false if /// <paramref name="item">item</paramref> is not found in the original /// <see cref="T:System.Collections.Generic.ICollection`1"></see>. /// </returns> /// <exception cref="NotImplementedException"></exception> public bool Remove(IYearlyRecurringEvent item) { if (GetStore(item).Remove(item)) { --Count; return(true); } return(false); }
/// <summary> /// Determines whether the <see cref="T:System.Collections.Generic.ICollection`1"></see> contains a specific value. /// </summary> /// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.ICollection`1"></see>.</param> /// <returns> /// true if <paramref name="item">item</paramref> is found in the /// <see cref="T:System.Collections.Generic.ICollection`1"></see>; otherwise, false. /// </returns> /// <exception cref="NotImplementedException"></exception> public bool Contains(IYearlyRecurringEvent item) => GetStore(item).Contains(item);