mirror of
https://github.com/BinaryAlley/Nemera.git
synced 2026-12-03 16:11:10 +00:00
Adds the shared fixtures for the theming feature tests
This commit is contained in:
1 parent
07bc20a9e6
commit
9c83e5dfa7
34 files changed
+1710
No files matched your search
@@ -0,0 +1,17 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Small model class used to verify section rendering against a plain object scope.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public sealed class SectionModel
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the text rendered by the section.
|
||||
/// </summary>
|
||||
public string Text { get; init; } = string.Empty;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#region ========================================================================= USING =====================================================================================
|
||||
using Bogus;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
#endregion
|
||||
|
||||
namespace Lumina.Presentation.Web.Fixtures.Common.Models;
|
||||
|
||||
/// <summary>
|
||||
/// Fixture class for generating <see cref="SectionModel"/> test data.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class SectionModelFixture
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="SectionModel"/> instance with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="text">Optional text rendered by the section.</param>
|
||||
/// <returns>A configured <see cref="SectionModel"/> instance.</returns>
|
||||
public SectionModel Create(string? text = null)
|
||||
{
|
||||
Faker faker = new();
|
||||
return new SectionModel { Text = text ?? faker.Lorem.Word() };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates multiple <see cref="SectionModel"/> instances with randomized test data.
|
||||
/// </summary>
|
||||
/// <param name="count">Number of instances to create.</param>
|
||||
/// <returns>List of configured <see cref="SectionModel"/> instances.</returns>
|
||||
public List<SectionModel> CreateMany(int count = 3)
|
||||
{
|
||||
return [.. Enumerable.Range(0, count).Select(_ => Create())];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user