mirror of
https://github.com/ivuorinen/hiha-arvio.git
synced 2026-02-25 01:53:46 +00:00
feat: implement services layer with TDD (Milestone 2)
Implemented all core services following strict TDD (RED-GREEN-REFACTOR): **Services Implemented:** - EstimateService: Generate estimates with intensity-based range selection - StorageService: SQLite persistence with auto-pruning - ShakeDetectionService: Accelerometer-based shake detection **Features:** - Cryptographically secure RNG for estimate selection - Easter egg logic (>15s shake → Humorous mode) - Intensity-based range calculation (0-0.3: 20%, 0.3-0.7: 50%, 0.7+: 100%) - SQLite with auto-pruning based on MaxHistorySize - Shake detection with 1.5g threshold - Duration tracking and intensity normalization (0.0-1.0) - Event-based notifications (ShakeDataChanged) **Tests:** - EstimateService: 25 tests (RED-GREEN-REFACTOR) - StorageService: 14 tests (RED-GREEN-REFACTOR) - ShakeDetectionService: 22 tests (RED-GREEN-REFACTOR) - Integration tests: 10 tests - Total: 119 tests, all passing **Quality:** - Build: 0 warnings, 0 errors across all platforms - Coverage: 51.28% line (low due to MAUI template), 87.5% branch - All service/model code has high coverage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
25
src/HihaArvio/Services/Interfaces/IEstimateService.cs
Normal file
25
src/HihaArvio/Services/Interfaces/IEstimateService.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using HihaArvio.Models;
|
||||
|
||||
namespace HihaArvio.Services.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Service for generating time estimates based on shake data.
|
||||
/// </summary>
|
||||
public interface IEstimateService
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates a time estimate based on shake intensity, duration, and selected mode.
|
||||
/// </summary>
|
||||
/// <param name="intensity">Normalized shake intensity (0.0 to 1.0).</param>
|
||||
/// <param name="duration">Duration of the shake gesture.</param>
|
||||
/// <param name="mode">The estimation mode (Work, Generic, or Humorous).</param>
|
||||
/// <returns>An EstimateResult with the generated estimate and metadata.</returns>
|
||||
/// <remarks>
|
||||
/// Per spec: If duration exceeds 15 seconds, mode is automatically changed to Humorous (easter egg).
|
||||
/// Intensity determines the range of possible estimates:
|
||||
/// - Low (0.0-0.3): narrow range (first 20% of pool)
|
||||
/// - Medium (0.3-0.7): medium range (first 50% of pool)
|
||||
/// - High (0.7-1.0): full range (entire pool)
|
||||
/// </remarks>
|
||||
EstimateResult GenerateEstimate(double intensity, TimeSpan duration, EstimateMode mode);
|
||||
}
|
||||
Reference in New Issue
Block a user