Path: redb/redb.Tests.Integration/Tests/Base/DecimalRoundTripTestsBase.cs
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Tests.Integration/Tests/Base/DecimalRoundTripTestsBase.cs
----
using redb.Core;
using redb.Core.Models.Entities;
using redb.Tests.Integration.Models;
namespace redb.Tests.Integration.Tests.Base;
///
/// A decimal saved and read back is the decimal that was saved: by a load, by a query, by Min and Max. SQLite keeps a
/// decimal in a REAL column by default, so its reader turns a double into a decimal; that conversion must give the
/// number that was stored on every runtime (the explicit conversion rounded to 15 digits up to .NET 10 and gives the
/// exact binary value from .NET 11 on: 123.45 came back as 123.45000000000000284217094304).
///
/// Each test reads only the objects it seeded (by a title of its own), so the shared database stays out.
///
public abstract class DecimalRoundTripTestsBase
{
protected readonly IRedbService Redb;
protected DecimalRoundTripTestsBase(IRedbService redb) => Redb = redb;
/// The provider keeps a decimal in a binary floating-point column (SQLite's default REAL mode).
protected virtual bool StoresDecimalAsDouble => false;
// The kinds a user has: an integer, a price, a long fraction (15 significant digits), a negative value, a small one.
public static IEnumerable