using System.Data.Common; using Dotnet.Samples.AspNetCore.WebApi.Data; using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; namespace Dotnet.Samples.AspNetCore.WebApi.Tests.Utilities { /// /// A Stub provides pre‑configured, hard‑coded responses to method calls. /// Its purpose is simply to supply data to the system under test without /// any behavior verification. For example, a Stub for a repository might /// always return a specific user regardless of the input. /// public static class PlayerStubs { /// /// Creates a ModelStateDictionary with a single validation error. /// Used for testing validation failure scenarios. /// /// The property name or key for the error. /// The error message. /// A ModelStateDictionary containing the specified error. public static ModelStateDictionary CreateModelError(string key, string errorMessage) { var modelStateDictionary = new ModelStateDictionary(); modelStateDictionary.AddModelError(key, errorMessage); return modelStateDictionary; } } }