list only my billing codes
Some checks failed
Dotnet build and test / build (pull_request) Failing after 11m23s
Some checks failed
Dotnet build and test / build (pull_request) Failing after 11m23s
This commit is contained in:
parent
7c565d3af9
commit
f7e1f4a736
3 changed files with 225 additions and 90 deletions
|
|
@ -7,6 +7,7 @@ using Yavsc.Api.Test.Fixtures;
|
|||
using Yavsc.Helpers;
|
||||
using Yavsc.Models;
|
||||
using Yavsc.Models.Billing;
|
||||
using Yavsc.Models.Haircut;
|
||||
using Yavsc.Models.Workflow;
|
||||
using Yavsc.Tests.Shared;
|
||||
|
||||
|
|
@ -154,6 +155,74 @@ VALUES
|
|||
Assert.DoesNotContain(payload!, item => string.IsNullOrWhiteSpace(item.BillingCode));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetProviderOngoingCommands_returns_haircut_and_grouped_haircut_requests()
|
||||
{
|
||||
WorkflowHelpers.ConfigureBillingService();
|
||||
_fixture.ResetAndSeedHaircutGraph();
|
||||
|
||||
using (var scope = _fixture.Services.CreateScope())
|
||||
{
|
||||
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
|
||||
db.UserActivities.Add(new UserActivity
|
||||
{
|
||||
UserId = "alice",
|
||||
DoesCode = "brush",
|
||||
Weight = 50,
|
||||
});
|
||||
db.UserActivities.Add(new UserActivity
|
||||
{
|
||||
UserId = "alice",
|
||||
DoesCode = "mbrush",
|
||||
Weight = 50,
|
||||
});
|
||||
db.CommandForm.Add(new CommandForm
|
||||
{
|
||||
ActivityCode = "brush",
|
||||
ActionName = BillingCodes.Brush,
|
||||
Title = "Brush",
|
||||
});
|
||||
db.CommandForm.Add(new CommandForm
|
||||
{
|
||||
ActivityCode = "mbrush",
|
||||
ActionName = BillingCodes.MBrush,
|
||||
Title = "MBrush",
|
||||
});
|
||||
db.SaveChanges();
|
||||
}
|
||||
|
||||
using var http = NewClient();
|
||||
|
||||
var response = await http.GetAsync("/api/v1/bill/provider/ongoing", TestContext.Current.CancellationToken);
|
||||
var body = await response.Content.ReadAsStringAsync(TestContext.Current.CancellationToken);
|
||||
|
||||
Assert.True(response.StatusCode == HttpStatusCode.OK, $"Unexpected status {(int)response.StatusCode} ({response.StatusCode}): {body}");
|
||||
|
||||
var payload = await response.Content.ReadFromJsonAsync<List<ProviderOngoingCommandDto>>(TestContext.Current.CancellationToken);
|
||||
Assert.NotNull(payload);
|
||||
Assert.Contains(payload!, item => item.BillingCode == BillingCodes.Brush && item.PerformerId == "alice");
|
||||
Assert.Contains(payload!, item => item.BillingCode == BillingCodes.MBrush && item.PerformerId == "alice");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task GetProviderOngoingCommands_excludes_requests_outside_performer_declared_activities()
|
||||
{
|
||||
WorkflowHelpers.ConfigureBillingService();
|
||||
_fixture.ResetAndSeedHaircutGraph();
|
||||
|
||||
using var http = NewClient();
|
||||
|
||||
var response = await http.GetAsync("/api/v1/bill/provider/ongoing", TestContext.Current.CancellationToken);
|
||||
var body = await response.Content.ReadAsStringAsync(TestContext.Current.CancellationToken);
|
||||
|
||||
Assert.True(response.StatusCode == HttpStatusCode.OK, $"Unexpected status {(int)response.StatusCode} ({response.StatusCode}): {body}");
|
||||
|
||||
var payload = await response.Content.ReadFromJsonAsync<List<ProviderOngoingCommandDto>>(TestContext.Current.CancellationToken);
|
||||
Assert.NotNull(payload);
|
||||
Assert.DoesNotContain(payload!, item => item.BillingCode == BillingCodes.Brush);
|
||||
Assert.DoesNotContain(payload!, item => item.BillingCode == BillingCodes.MBrush);
|
||||
}
|
||||
|
||||
private sealed class ProviderOngoingCommandDto
|
||||
{
|
||||
public long Id { get; set; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue