first commit

This commit is contained in:
2026-06-29 07:36:04 +02:00
commit 5e5b875e37
108 changed files with 13347 additions and 0 deletions
@@ -0,0 +1,31 @@
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
{
/// <summary>
/// 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.
/// </summary>
public static class PlayerStubs
{
/// <summary>
/// Creates a ModelStateDictionary with a single validation error.
/// Used for testing validation failure scenarios.
/// </summary>
/// <param name="key">The property name or key for the error.</param>
/// <param name="errorMessage">The error message.</param>
/// <returns>A ModelStateDictionary containing the specified error.</returns>
public static ModelStateDictionary CreateModelError(string key, string errorMessage)
{
var modelStateDictionary = new ModelStateDictionary();
modelStateDictionary.AddModelError(key, errorMessage);
return modelStateDictionary;
}
}
}