test(backend): cover step 17 modules and extract stubs
Add tests for partnership workflow, middleman adaptation and idea notifications; extract reusable test stubs into separate files; add architecture guard forbidding object-valued dictionaries in data contracts.
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using TarninaHub.Application.Abstractions;
|
||||
using TarninaHub.Application.Dtos;
|
||||
|
||||
namespace TarninaHub.Tests.Stubs;
|
||||
|
||||
/// <summary>Configurable ISubmissionService stub for controller tests.</summary>
|
||||
public sealed class StubSubmissionService : ISubmissionService
|
||||
{
|
||||
public SubmissionResponse? Current { get; set; }
|
||||
|
||||
public SubmissionResponse? UpdateResult { get; set; }
|
||||
|
||||
public string? LastRequestedStatus { get; private set; }
|
||||
|
||||
public Task<SubmissionResponse> CreateAsync(
|
||||
string authorId,
|
||||
CreateSubmissionRequest request,
|
||||
CancellationToken cancellationToken) => Task.FromResult(Current ?? throw new InvalidOperationException());
|
||||
|
||||
public Task<PagedResponse<SubmissionResponse>> ListAsync(
|
||||
string viewerId,
|
||||
bool isStaff,
|
||||
string? status,
|
||||
int page,
|
||||
int pageSize,
|
||||
CancellationToken cancellationToken) => Task.FromResult(
|
||||
new PagedResponse<SubmissionResponse>([], page, pageSize, 0));
|
||||
|
||||
public Task<SubmissionResponse?> GetAsync(string submissionId, CancellationToken cancellationToken) =>
|
||||
Task.FromResult(Current);
|
||||
|
||||
public Task<SubmissionResponse?> UpdateStatusAsync(
|
||||
string submissionId,
|
||||
string newStatus,
|
||||
CancellationToken cancellationToken)
|
||||
{
|
||||
LastRequestedStatus = newStatus;
|
||||
|
||||
return Task.FromResult(UpdateResult);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user