Code Clenup
This commit is contained in:
@@ -46,29 +46,19 @@ internal static class ServiceTestSupport
|
||||
public int HashCalls { get; private set; }
|
||||
}
|
||||
|
||||
private sealed class FixedDiceRoller : IDiceRoller
|
||||
private sealed class FixedDiceRoller(IEnumerable<int> values) : IDiceRoller
|
||||
{
|
||||
public FixedDiceRoller(IEnumerable<int> values)
|
||||
{
|
||||
m_Values = new(values);
|
||||
}
|
||||
|
||||
public int Roll(int sides)
|
||||
{
|
||||
var next = m_Values.Count > 0 ? m_Values.Dequeue() : 1;
|
||||
return Math.Clamp(next, 1, sides);
|
||||
}
|
||||
|
||||
private readonly Queue<int> m_Values;
|
||||
private readonly Queue<int> m_Values = new(values);
|
||||
}
|
||||
|
||||
internal sealed class SqliteDbContextFactory : IDbContextFactory<RpgRollerDbContext>, IDisposable
|
||||
internal sealed class SqliteDbContextFactory(string dbPath) : IDbContextFactory<RpgRollerDbContext>, IDisposable
|
||||
{
|
||||
public SqliteDbContextFactory(string dbPath)
|
||||
{
|
||||
m_Options = new DbContextOptionsBuilder<RpgRollerDbContext>().UseSqlite($"Data Source={dbPath}").Options;
|
||||
}
|
||||
|
||||
public RpgRollerDbContext CreateDbContext()
|
||||
{
|
||||
return new(m_Options);
|
||||
@@ -78,7 +68,7 @@ internal static class ServiceTestSupport
|
||||
{
|
||||
}
|
||||
|
||||
private readonly DbContextOptions<RpgRollerDbContext> m_Options;
|
||||
private readonly DbContextOptions<RpgRollerDbContext> m_Options = new DbContextOptionsBuilder<RpgRollerDbContext>().UseSqlite($"Data Source={dbPath}").Options;
|
||||
}
|
||||
|
||||
internal static ServiceHarness CreateHarness(params int[] rollValues)
|
||||
|
||||
Reference in New Issue
Block a user