mirror of
https://github.com/ivuorinen/hiha-arvio.git
synced 2026-01-26 03:14:00 +00:00
MILESTONE 1 COMPLETE: Project Setup: - Create .NET 8 MAUI solution targeting iOS, macOS, and web - Configure nullable reference types and warnings as errors - Add required dependencies (MAUI 8.0.3, SQLite, CommunityToolkit.Mvvm) - Add testing dependencies (xUnit, NSubstitute, FluentAssertions, Coverlet) - Create comprehensive .editorconfig with C# coding standards - Update CLAUDE.md with development commands Core Models (TDD - 48 tests, all passing): - EstimateMode enum (Work, Generic, Humorous modes) - EstimateResult model with validation (intensity 0.0-1.0, non-null text) - ShakeData model with intensity validation - AppSettings model with defaults (Work mode, max history 10) Build Status: - All platforms build successfully (net8.0, iOS, macOS) - 0 warnings, 0 errors - Test coverage: 51.28% line, 87.5% branch (models have ~100% coverage) Per spec: Strict TDD followed (RED-GREEN-REFACTOR), models fully validated 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
107 lines
2.6 KiB
C#
107 lines
2.6 KiB
C#
using FluentAssertions;
|
|
using HihaArvio.Models;
|
|
|
|
namespace HihaArvio.Tests.Models;
|
|
|
|
public class ShakeDataTests
|
|
{
|
|
[Fact]
|
|
public void ShakeData_ShouldCreateWithAllProperties()
|
|
{
|
|
// Arrange
|
|
var intensity = 0.65;
|
|
var duration = TimeSpan.FromSeconds(3);
|
|
var isShaking = true;
|
|
|
|
// Act
|
|
var shakeData = new ShakeData
|
|
{
|
|
Intensity = intensity,
|
|
Duration = duration,
|
|
IsShaking = isShaking
|
|
};
|
|
|
|
// Assert
|
|
shakeData.Intensity.Should().Be(intensity);
|
|
shakeData.Duration.Should().Be(duration);
|
|
shakeData.IsShaking.Should().Be(isShaking);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(0.0)]
|
|
[InlineData(0.25)]
|
|
[InlineData(0.5)]
|
|
[InlineData(0.75)]
|
|
[InlineData(1.0)]
|
|
public void ShakeData_ShouldAcceptValidIntensityValues(double intensity)
|
|
{
|
|
// Act
|
|
var shakeData = new ShakeData { Intensity = intensity };
|
|
|
|
// Assert
|
|
shakeData.Intensity.Should().Be(intensity);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(-0.1)]
|
|
[InlineData(-1.0)]
|
|
[InlineData(1.01)]
|
|
[InlineData(2.0)]
|
|
public void ShakeData_ShouldThrowForInvalidIntensity(double invalidIntensity)
|
|
{
|
|
// Act
|
|
Action act = () => _ = new ShakeData { Intensity = invalidIntensity };
|
|
|
|
// Assert
|
|
act.Should().Throw<ArgumentOutOfRangeException>()
|
|
.WithMessage("*must be between 0.0 and 1.0*");
|
|
}
|
|
|
|
[Fact]
|
|
public void ShakeData_ShouldAcceptZeroDuration()
|
|
{
|
|
// Act
|
|
var shakeData = new ShakeData { Duration = TimeSpan.Zero };
|
|
|
|
// Assert
|
|
shakeData.Duration.Should().Be(TimeSpan.Zero);
|
|
}
|
|
|
|
[Fact]
|
|
public void ShakeData_ShouldAcceptPositiveDuration()
|
|
{
|
|
// Arrange
|
|
var duration = TimeSpan.FromSeconds(15.5);
|
|
|
|
// Act
|
|
var shakeData = new ShakeData { Duration = duration };
|
|
|
|
// Assert
|
|
shakeData.Duration.Should().Be(duration);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(true)]
|
|
[InlineData(false)]
|
|
public void ShakeData_ShouldAcceptBooleanIsShakingValues(bool isShaking)
|
|
{
|
|
// Act
|
|
var shakeData = new ShakeData { IsShaking = isShaking };
|
|
|
|
// Assert
|
|
shakeData.IsShaking.Should().Be(isShaking);
|
|
}
|
|
|
|
[Fact]
|
|
public void ShakeData_DefaultConstructor_ShouldSetDefaultValues()
|
|
{
|
|
// Act
|
|
var shakeData = new ShakeData();
|
|
|
|
// Assert
|
|
shakeData.Intensity.Should().Be(0.0);
|
|
shakeData.Duration.Should().Be(TimeSpan.Zero);
|
|
shakeData.IsShaking.Should().BeFalse();
|
|
}
|
|
}
|