Document commute provider seam for personal report

This commit is contained in:
Jacob Dubin
2026-05-20 23:25:41 -05:00
parent c76af83d7e
commit 884b2215c7
21 changed files with 1046 additions and 55 deletions

View File

@@ -167,6 +167,43 @@ public sealed class JiboCloudProtocolServiceTests
}
}
[Fact]
public async Task PersonUpsertCommute_ThenListCommute_ReturnsPersistedLoopProfile()
{
var service = new JiboCloudProtocolService(new InMemoryCloudStateStore());
var upsert = await service.DispatchAsync(new ProtocolEnvelope
{
HostName = "api.jibo.com",
Method = "POST",
ServicePrefix = "Person_20160715",
Operation = "UpsertCommute",
BodyText =
"""{"loopId":"loop-123","mode":"walking","workHour":8,"workMinute":15,"typicalDurationMinutes":22}"""
});
using var upsertPayload = JsonDocument.Parse(upsert.BodyText);
Assert.Equal(200, upsert.StatusCode);
Assert.Equal("loop-123", upsertPayload.RootElement.GetProperty("loopId").GetString());
Assert.Equal("walking", upsertPayload.RootElement.GetProperty("mode").GetString());
var listed = await service.DispatchAsync(new ProtocolEnvelope
{
HostName = "api.jibo.com",
Method = "POST",
ServicePrefix = "Person_20160715",
Operation = "ListCommute",
BodyText = """{"loopId":"loop-123"}"""
});
using var listedPayload = JsonDocument.Parse(listed.BodyText);
Assert.Equal(200, listed.StatusCode);
Assert.Contains(listedPayload.RootElement.EnumerateArray(),
item => item.GetProperty("loopId").GetString() == "loop-123" &&
item.GetProperty("mode").GetString() == "walking" &&
item.GetProperty("workHour").GetInt32() == 8);
}
[Fact]
public async Task MediaCreateAndGet_ReturnsCreatedItem()
{