Skip to content

Commit cfaebae

Browse files
committed
Complete the change to use CSharpFunctionalExtensions
1 parent 448251c commit cfaebae

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

src/AStar.Dev.Api.HealthChecks/HealthCheckExtensions.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,12 @@ private static Task WriteHealthCheckResponseAsync(
6262

6363
var dependencyHealthChecks = healthReport.Entries.Select(static entry => new HealthStatusResponse
6464
{
65-
Name = entry.Key,
66-
Description = entry.Value.Description,
67-
Status = entry.Value.Status.ToString(),
68-
DurationInMilliseconds = entry.Value.Duration
69-
.TotalMilliseconds,
70-
Data = entry.Value.Data,
71-
Exception = entry.Value.Exception?.Message
65+
Name = entry.Key,
66+
Description = entry.Value.Description,
67+
Status = entry.Value.Status.ToString(),
68+
DurationInMilliseconds = entry.Value.Duration.TotalMilliseconds,
69+
Data = entry.Value.Data,
70+
Exception = entry.Value.Exception?.Message
7271
});
7372

7473
var healthCheckResponse = new

test/AStar.Dev.Api.HealthChecks.Tests.Unit/HealthStatusResponseShould.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,15 @@ public class HealthStatusResponseShould
1010
public void ContainTheExpectedProperties()
1111
{
1212
new HealthStatusResponse
13-
{ Name = "Test Name", Description = "Test Description", DurationInMilliseconds = 123, Data = new Dictionary<string, object>(), Exception = "Test Exception", Status = "OK" }
14-
.ToJson().ShouldMatchApproved();
13+
{
14+
Name = "Test Name",
15+
Description = "Test Description",
16+
DurationInMilliseconds = 123,
17+
Data = new Dictionary<string, object>(),
18+
Exception = "Test Exception",
19+
Status = "OK"
20+
}
21+
.ToJson()
22+
.ShouldMatchApproved();
1523
}
1624
}

0 commit comments

Comments
 (0)