Skip to content

Demo eines Zähler-Kalibrier-Workflows: WPF/MVVM + EF Core + xUnit. Für Portfolio & Lernzwecke, CI inklusive.

License

FirdevsTorlak/MeterCalibDesk

Repository files navigation

MeterCalibDesk — WPF (MVVM) + EF Core + xUnit

What is this? A small desktop reference app that demonstrates a basic meter calibration workflow and modern .NET desktop patterns: WPF + MVVM, Entity Framework Core, dependency injection with HostBuilder, and xUnit tests.
Why? To provide a clear, reproducible example of a calibration UI and data model that compiles, runs, and is easy to extend — useful as portfolio material or as a learning scaffold.

Stack: .NET 8, WPF (MVVM with CommunityToolkit.Mvvm), EF Core (InMemory by default; SQL Server optional), xUnit, VS Code.
CI: Azure DevOps sample pipeline included.

Quickstart (Windows, VS Code)

  1. Install .NET SDK 8.x.
  2. Open this folder in VS Code.
  3. Build and run:
    dotnet build
    dotnet run --project src/MeterCalibDesk.UI
  4. Run tests:
    dotnet test

What it demonstrates

  • WPF + MVVM
    • Commands for Add Meter, Start Calibration, Progress, Finish (Pass/Fail)
    • Data binding to lists and a progress bar
  • EF Core
    • InMemory provider (zero‑setup) and optional SQL Server/LocalDB
  • Dependency Injection
    • HostBuilder with DI for view models and repositories
  • Testing
    • xUnit test that adds a meter, starts a run, updates progress, and finishes
  • DevOps
    • Azure DevOps pipeline (azure-pipelines.yml) for restore → build → test → publish

How calibration is simulated

There is no physical bench in this demo. Start Calibration creates a CalibrationRun record and sets the selected meter’s status to Calibrating. Simulate 50% writes Progress=50 on the run. Finish closes the run (Pass/Fail), sets the meter back to Idle, and shows 100% in the progress bar. The aim is to show UI flow + data updates, not real hardware I/O.

Switch to SQL Server (optional)

Edit src/MeterCalibDesk.UI/appsettings.json → set "UseInMemoryDatabase": false and provide a SQL Server/LocalDB connection string:

{
  "Database": {
    "UseInMemoryDatabase": false,
    "SqlServer": {
      "ConnectionString": "Server=(localdb)\\MSSQLLocalDB;Database=MeterCalibDesk;Trusted_Connection=True;MultipleActiveResultSets=true;TrustServerCertificate=True"
    }
  }
}

The demo uses EnsureCreated() to bootstrap schema.

Project layout

MeterCalibDesk/
├─ src/
│  ├─ MeterCalibDesk.UI/         # WPF app (MVVM, DI, HostBuilder)
│  └─ MeterCalibDesk.Data/       # EF Core entities + repositories
├─ tests/
│  └─ MeterCalibDesk.Tests/      # xUnit tests (InMemory)
├─ .vscode/                      # launch/tasks (VS Code)
├─ azure-pipelines.yml           # Azure DevOps CI sample
└─ README.md

Evidence (optional but recommended)

  • Build and test logs (e.g., evidence/build.log, evidence/test.log, Tests.trx)
  • Published binaries (e.g., evidence/publish/) + hash (exe_sha256.txt)
  • One screenshot of the Meters screen with the bottom toolbar
  • dotnet --info saved as evidence/dotnet_info.txt

Roadmap ideas

  • Calibration parameters & result details
  • Run history table with filtering
  • EF Core Migrations for SQL Server
  • Logging/telemetry (Serilog), exception handling
  • Integration tests (SQL) and ViewModel tests
  • Optional TFS/Azure DevOps Server boards build; GitHub Actions workflow

License

MIT – see LICENSE.

CI

About

Demo eines Zähler-Kalibrier-Workflows: WPF/MVVM + EF Core + xUnit. Für Portfolio & Lernzwecke, CI inklusive.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages