61 lines
2.1 KiB
C#
61 lines
2.1 KiB
C#
using Xunit;
|
|
using Newtonsoft.Json.Linq;
|
|
using FluentAssertions;
|
|
|
|
namespace raven_integration
|
|
{
|
|
|
|
public class ScheduleReads
|
|
{
|
|
|
|
/// <summary>
|
|
/// Verify the service schedule endpoint returns a well-formed response for a 7-day window
|
|
/// </summary>
|
|
[Fact]
|
|
public async Task ServiceSchedule_ReturnsSuccessfully()
|
|
{
|
|
var token = await Util.GetTokenAsync("BizAdmin");
|
|
|
|
var start = DateTime.Today.ToString("o");
|
|
var end = DateTime.Today.AddDays(7).ToString("o");
|
|
|
|
var payload = $$"""
|
|
{"view":2,"start":"{{start}}","end":"{{end}}","wisuColorSource":2,"tags":[],"dark":false}
|
|
""";
|
|
|
|
ApiResponse a = await Util.PostAsync("schedule/svc", token, payload);
|
|
Util.ValidateHTTPStatusCode(a, 200);
|
|
Util.ValidateDataReturnResponseOk(a);
|
|
|
|
// Verify the response shape — items must be present as a JArray (may be empty if no WOs are scheduled)
|
|
a.ObjectResponse["data"]["items"].Should().NotBeNull("schedule/svc response data should contain an items key");
|
|
a.ObjectResponse["data"]["items"].Should().BeOfType<JArray>("items should be a JArray");
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// Verify the personal schedule endpoint returns a well-formed response for a 7-day window
|
|
/// </summary>
|
|
[Fact]
|
|
public async Task PersonalSchedule_ReturnsSuccessfully()
|
|
{
|
|
var token = await Util.GetTokenAsync("BizAdmin");
|
|
|
|
var start = DateTime.Today.ToString("o");
|
|
var end = DateTime.Today.AddDays(7).ToString("o");
|
|
|
|
var payload = $$"""
|
|
{"view":2,"start":"{{start}}","end":"{{end}}","wisuColorSource":2,"wisu":false,"reviews":false,"reminders":false,"dark":false,"userId":0}
|
|
""";
|
|
|
|
ApiResponse a = await Util.PostAsync("schedule/personal", token, payload);
|
|
Util.ValidateHTTPStatusCode(a, 200);
|
|
Util.ValidateDataReturnResponseOk(a);
|
|
}
|
|
|
|
|
|
//==================================================
|
|
|
|
}//eoc
|
|
}//eons
|