mirror of
https://github.com/ivuorinen/hiha-arvio.git
synced 2026-02-09 08:47:49 +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>
91 lines
2.1 KiB
C#
91 lines
2.1 KiB
C#
using FluentAssertions;
|
|
using HihaArvio.Models;
|
|
|
|
namespace HihaArvio.Tests.Models;
|
|
|
|
public class AppSettingsTests
|
|
{
|
|
[Fact]
|
|
public void AppSettings_DefaultConstructor_ShouldSetWorkModeAsDefault()
|
|
{
|
|
// Act
|
|
var settings = new AppSettings();
|
|
|
|
// Assert
|
|
settings.SelectedMode.Should().Be(EstimateMode.Work);
|
|
}
|
|
|
|
[Fact]
|
|
public void AppSettings_DefaultConstructor_ShouldSetMaxHistorySizeTo10()
|
|
{
|
|
// Act
|
|
var settings = new AppSettings();
|
|
|
|
// Assert
|
|
settings.MaxHistorySize.Should().Be(10);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(EstimateMode.Work)]
|
|
[InlineData(EstimateMode.Generic)]
|
|
[InlineData(EstimateMode.Humorous)]
|
|
public void AppSettings_ShouldAllowModeChanges(EstimateMode mode)
|
|
{
|
|
// Arrange
|
|
var settings = new AppSettings();
|
|
|
|
// Act
|
|
settings.SelectedMode = mode;
|
|
|
|
// Assert
|
|
settings.SelectedMode.Should().Be(mode);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(1)]
|
|
[InlineData(5)]
|
|
[InlineData(10)]
|
|
[InlineData(50)]
|
|
[InlineData(100)]
|
|
public void AppSettings_ShouldAcceptValidMaxHistorySizeValues(int size)
|
|
{
|
|
// Arrange
|
|
var settings = new AppSettings();
|
|
|
|
// Act
|
|
settings.MaxHistorySize = size;
|
|
|
|
// Assert
|
|
settings.MaxHistorySize.Should().Be(size);
|
|
}
|
|
|
|
[Theory]
|
|
[InlineData(0)]
|
|
[InlineData(-1)]
|
|
[InlineData(-10)]
|
|
public void AppSettings_ShouldThrowForInvalidMaxHistorySize(int invalidSize)
|
|
{
|
|
// Arrange
|
|
var settings = new AppSettings();
|
|
|
|
// Act
|
|
Action act = () => settings.MaxHistorySize = invalidSize;
|
|
|
|
// Assert
|
|
act.Should().Throw<ArgumentOutOfRangeException>()
|
|
.WithMessage("*must be greater than 0*");
|
|
}
|
|
|
|
[Fact]
|
|
public void AppSettings_ShouldCreateWithDefaultValues()
|
|
{
|
|
// Act
|
|
var settings = new AppSettings();
|
|
|
|
// Assert
|
|
settings.Should().NotBeNull();
|
|
settings.SelectedMode.Should().Be(EstimateMode.Work);
|
|
settings.MaxHistorySize.Should().Be(10);
|
|
}
|
|
}
|