Files
Hy2026/tests/TarninaHub.Tests/Stubs/StubIdeaService.cs
T
Rafał Tyński cca20a9965 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.
2026-10-04 03:49:51 +02:00

32 lines
1.5 KiB
C#

using TarninaHub.Application.Abstractions;
using TarninaHub.Application.Dtos;
namespace TarninaHub.Tests.Stubs;
/// <summary>Minimal IIdeaService stub for controller tests.</summary>
public sealed class StubIdeaService : IIdeaService
{
public IdeaResponse? Idea { get; set; }
public Task<IdeaResponse> CreateAsync(string authorId, CreateIdeaRequest request, CancellationToken cancellationToken) =>
Task.FromResult(Idea ?? throw new InvalidOperationException());
public Task<IdeaResponse?> GetAsync(string ideaId, CancellationToken cancellationToken) =>
Task.FromResult(Idea);
public Task<IReadOnlyList<IdeaResponse>> ListForAuthorAsync(string authorId, CancellationToken cancellationToken) =>
Task.FromResult<IReadOnlyList<IdeaResponse>>(Idea is null ? [] : [Idea]);
public Task<IReadOnlyList<string>> ListDistinctAuthorIdsAsync(CancellationToken cancellationToken) =>
Task.FromResult<IReadOnlyList<string>>(Idea is null ? [] : [Idea.AuthorId]);
public Task<IdeaResponse?> UpdateAsync(string ideaId, UpdateIdeaRequest request, CancellationToken cancellationToken) =>
Task.FromResult(Idea);
public Task<IdeaCardResponse?> GetCardAsync(string ideaId, CancellationToken cancellationToken) =>
Task.FromResult<IdeaCardResponse?>(null);
public Task<IdeaCardResponse?> UpdateCardAsync(string ideaId, IdeaCardRequest request, CancellationToken cancellationToken) =>
Task.FromResult<IdeaCardResponse?>(null);
}