Skip to content

Commit

Permalink
Updated tests for educational performance
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominic NEED authored and Dominic NEED committed Nov 20, 2023
1 parent 56c7150 commit 0edb510
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ public KeyStageDataTagHelperTests(IntegrationTestingWebApplicationFactory factor

[Theory]
[InlineData(0, StatusType.Provisional, "YearIndex 0 would be the current year, thus, status is provisional based on the currentDate variables month")]
[InlineData(1, StatusType.Final, "YearIndex 1 would be a year ago, thus, status is Final")]
[InlineData(1, StatusType.Provisional, "YearIndex 1 would be a year ago, thus, status is Final")]
[InlineData(2, StatusType.Final, "YearIndex 2 would be two years ago, thus, status is Final")]
[InlineData(3, StatusType.Final, "Edge case: If greater than our expected (Likely due to extending the number of years served in the future)")]
[InlineData(-1, StatusType.Final, "Edge case: Default to Final")]
[InlineData(-1, StatusType.Final, "Edge case: Default to Final")]
public void KeyStageHeader_ReturnsExpectedStatusHeader(int yearIndex, StatusType expectedStatusType, string reason)
{
// Arrange
Expand Down Expand Up @@ -94,17 +94,17 @@ public static IEnumerable<object[]> ProvisionalDates()

public static IEnumerable<object[]> RevisedDates()
{
yield return new object[] { new DateTime(DateTime.Now.Year, 1, 3) };
yield return new object[] { new DateTime(DateTime.Now.Year, 2, 11) };
yield return new object[] { new DateTime(DateTime.Now.Year, 3, 21) };
yield return new object[] { new DateTime(DateTime.Now.Year, 4, 14) };
yield return new object[] { new DateTime(DateTime.Now.Year - 1, 1, 3) };
yield return new object[] { new DateTime(DateTime.Now.Year - 1, 2, 11) };
yield return new object[] { new DateTime(DateTime.Now.Year - 1, 3, 21) };
yield return new object[] { new DateTime(DateTime.Now.Year - 1, 4, 14) };
}

public static IEnumerable<object[]> FinalDates()
{
yield return new object[] { new DateTime(DateTime.Now.Year - 2, 1, 3) };
yield return new object[] { new DateTime(DateTime.Now.Year - 2, 2, 11) };
yield return new object[] { new DateTime(DateTime.Now.Year, 5, 21) };
yield return new object[] { new DateTime(DateTime.Now.Year, 6, 14) };
yield return new object[] { new DateTime(DateTime.Now.Year - 1, 5, 21) };
yield return new object[] { new DateTime(DateTime.Now.Year - 1, 6, 14) };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,8 @@ static DateTime ConvertToDateTime(string input)
{
return new DateTime(endYear, 8, 31); // Last day of Aug to mark end of academic year

Check warning on line 112 in Dfe.PrepareConversions/Dfe.PrepareConversions/Utils/KeyStageDataStatusHelper.cs

View workflow job for this annotation

GitHub Actions / build

Provide the "DateTimeKind" when creating this object. (https://rules.sonarsource.com/csharp/RSPEC-6562)
}
else
{
throw new ArgumentException("Invalid input format.");
}
// Default to current year if the year isn't in the expected value
return DateTime.UtcNow;
}
public static string KeyStageHeader(int yearIndex, KeyStages keyStage)
{
Expand Down

0 comments on commit 0edb510

Please sign in to comment.