-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support recurrence for TimeWindowFilter (#266)
* improvement & target on main branch * remove duplicated null check * remove redundant if * improvement * resolve comments * fix typo * update * use enum * Update testcases * fix bug * update * update the logic of FindWeeklyPreviousOccurrence * fix bug * add comments * update * fix bug & add testcases * update * update comment * test * update comments * update * update * add testcase * remove monthly/yearly recurrence pattern * do not mention monthly and yearly pattern * add more comments * update the algorithm to find weekly previous occurrence * update * fix typo * update * rename variable * cache added & do validation for only once * add comments * add more testcases * add more test * not include the end of a time window * move recurrence validation to RecurrenceValidator * README updated * update readme * update CalculateSurroundingOccurrences method * add CalculateClosestStart method * testcase updated * update * use ISystemClock for testing & add limit on time window duration * add testcase for timezone * update * update comments * change method type * remove unused reference * rename variable * remove used reference * remove empty lines
- Loading branch information
1 parent
a63856c
commit 44033d2
Showing
18 changed files
with
3,046 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
src/Microsoft.FeatureManagement/FeatureFilters/ISystemClock.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
// | ||
|
||
using System; | ||
|
||
namespace Microsoft.FeatureManagement.FeatureFilters | ||
{ | ||
/// <summary> | ||
/// Abstracts the system clock to facilitate testing. | ||
/// .NET8 offers an abstract class TimeProvider. After we stop supporting .NET version less than .NET8, this ISystemClock should retire. | ||
/// </summary> | ||
internal interface ISystemClock | ||
{ | ||
/// <summary> | ||
/// Retrieves the current system time in UTC. | ||
/// </summary> | ||
public DateTimeOffset UtcNow { get; } | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/Microsoft.FeatureManagement/FeatureFilters/Recurrence/Recurrence.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
// | ||
namespace Microsoft.FeatureManagement.FeatureFilters | ||
{ | ||
/// <summary> | ||
/// A recurrence definition describing how time window recurs | ||
/// </summary> | ||
public class Recurrence | ||
{ | ||
/// <summary> | ||
/// The recurrence pattern specifying how often the time window repeats | ||
/// </summary> | ||
public RecurrencePattern Pattern { get; set; } | ||
|
||
/// <summary> | ||
/// The recurrence range specifying how long the recurrence pattern repeats | ||
/// </summary> | ||
public RecurrenceRange Range { get; set; } | ||
} | ||
} |
Oops, something went wrong.