Skip to content

Commit

Permalink
Updated the logic
Browse files Browse the repository at this point in the history
  • Loading branch information
samsmithnz committed Aug 9, 2023
1 parent 77fa436 commit b5de1c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/RepoGovernance.Core/Models/AzureAppRegistration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ public string ExpirationDateString
}
else
{
return "No Expiration Date Found";
return "No expiration date found";
}

}
}
public DateTimeOffset? ExpirationDate
Expand All @@ -26,7 +25,7 @@ public string ExpirationDateString
DateTimeOffset? minDate = null;
foreach (DateTimeOffset? item in ExpirationDates)
{
if (item != null && item < minDate)
if (item != null && (minDate == null || item < minDate))
{
minDate = item;
}
Expand Down
1 change: 1 addition & 0 deletions src/RepoGovernance.Tests/AzureApiTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public async Task GetApplicationsItemTest()
Assert.IsNotNull(result);
Assert.AreEqual(2, result.AppRegistrations.Count);
Assert.AreEqual(1, result.AppRegistrations[0].ExpirationDates.Count);
Assert.IsNotNull(result.AppRegistrations[0].ExpirationDate);
Assert.AreEqual(1, result.AppRegistrations[1].ExpirationDates.Count);
}

Expand Down

0 comments on commit b5de1c1

Please sign in to comment.