Skip to content

Commit fea9442

Browse files
authored
Add RepoMan (#104)
Add the code for the Repoman azure function, and the associated test project. That added one additional class from the shared library. Bump the version numbers on the updated projects. Upgrade to .NET 7 (which is now supported for Azure Functions)
1 parent 9dfc3f8 commit fea9442

35 files changed

+3638
-2
lines changed

DotNet.DocsTools/DotNet.DocsTools.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<TargetFramework>net7.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
7-
<AssemblyVersion>2.0.0.1</AssemblyVersion>
8-
<FileVersion>2.0.0.1</FileVersion>
7+
<AssemblyVersion>2.0.0.2</AssemblyVersion>
8+
<FileVersion>2.0.0.2</FileVersion>
99
</PropertyGroup>
1010

1111
<ItemGroup>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
namespace DotNet.DocsTools.Utility;
2+
3+
/// <summary>
4+
/// Manage start and end dates for a single sprint.
5+
/// </summary>
6+
/// <remarks>
7+
/// Static methods find a sprint based on a date, and an offset from that date.
8+
/// Instance members retrieve the start date, end date, and title for the sprint.
9+
/// </remarks>
10+
public class SprintDateRange
11+
{
12+
/// <summary>
13+
/// Retrieve the sprint object for a given date.
14+
/// </summary>
15+
/// <param name="selectedDate">The date selected</param>
16+
/// <returns>A SprintDateRange object for the current sprint.</returns>
17+
/// <exception cref="ArgumentOutOfRangeException">
18+
/// When the date is outside of the range of the known sprints.
19+
/// </exception>
20+
public static SprintDateRange GetSprintFor(DateTime selectedDate)
21+
{
22+
var sprintName = selectedDate.ToString("MMMM yyyy");
23+
var sprintStartDate = new DateTime(selectedDate.Year, selectedDate.Month, 1);
24+
var sprintEndDate = sprintStartDate.AddMonths(1).AddDays(-1);
25+
return new SprintDateRange(sprintName, sprintStartDate, sprintEndDate);
26+
}
27+
28+
/// <summary>
29+
/// Retrieve a sprint based on a date and an offset.
30+
/// </summary>
31+
/// <param name="offset">The offset (positive or negative) from the selected date.</param>
32+
/// <param name="selectedDate">The chosen date to start from.</param>
33+
/// <returns>A SprintDateRange object that represents the selected sprint.</returns>
34+
/// <exception cref="ArgumentOutOfRangeException">
35+
/// When the date and offset produce a sprint outside of the known range.
36+
/// </exception>
37+
public static SprintDateRange GetOffsetSprintFor(int offset, DateTime selectedDate)
38+
{
39+
var startDate = selectedDate.AddMonths(offset);
40+
return GetSprintFor(startDate);
41+
}
42+
43+
private SprintDateRange(string sprintName, DateTime startDate, DateTime endDate)
44+
{
45+
SprintName = sprintName;
46+
StartDate = startDate;
47+
EndDate = endDate;
48+
}
49+
50+
/// <summary>
51+
/// Retrieve the name of the sprint
52+
/// </summary>
53+
/// <returns></returns>
54+
public override string ToString() => SprintName;
55+
56+
/// <summary>
57+
/// The first date of the sprint.
58+
/// </summary>
59+
public DateTime StartDate { get; }
60+
61+
/// <summary>
62+
/// The last date of the sprint.
63+
/// </summary>
64+
public DateTime EndDate { get; }
65+
66+
/// <summary>
67+
/// The name of the sprint, as used in all reporting.
68+
/// </summary>
69+
public string SprintName { get; }
70+
}

0 commit comments

Comments
 (0)