My personal blog, website, and other random tools.
  • HTML 95.4%
  • C# 2.9%
  • CSS 1.6%
Find a file
2026-04-27 08:06:45 +01:00
.vscode docs: updated docs with hld lld and testing strategy 2026-04-27 08:06:00 +01:00
coverage tests: excluded dto models from test coverage 2026-04-26 17:45:11 +01:00
CrashTest.Dev tests: update coverage to exclude untestable code 2026-04-26 16:33:04 +01:00
CrashTest.Dev.AppHost tests: fixed controller tests 2026-04-25 13:23:43 +01:00
CrashTest.Dev.Client tests: update coverage to exclude untestable code 2026-04-26 16:33:04 +01:00
CrashTest.Dev.Common tests: excluded dto models from test coverage 2026-04-26 17:45:11 +01:00
CrashTest.Dev.Components chore: cleanup and working on testing stratagy 2026-04-25 08:33:32 +01:00
CrashTest.Dev.DB tests: update coverage to exclude untestable code 2026-04-26 16:33:04 +01:00
CrashTest.Dev.MigrationService tests: fixed controller tests 2026-04-25 13:23:43 +01:00
CrashTest.Dev.ServiceDefaults tests: fixed controller tests 2026-04-25 13:23:43 +01:00
docs docs: updated docs with hld lld and testing strategy 2026-04-27 08:06:00 +01:00
Tests docs: updated docs with hld lld and testing strategy 2026-04-27 08:06:00 +01:00
.gitignore Initial commit 2026-04-15 10:50:36 +01:00
aspire.config.json Initial commit 2026-04-15 10:50:36 +01:00
CrashTest.Dev.sln tests: all tests are passing 2026-04-26 07:14:03 +01:00
LICENCE Added LICENCE 2026-04-15 10:51:36 +01:00
README.md docs: updated docs with hld lld and testing strategy 2026-04-27 08:06:00 +01:00
tests.runsettings tests: update coverage to exclude untestable code 2026-04-26 16:33:04 +01:00

CrashTest.Dev

This serves as my personal blog and other general tools, a "Personal Repository of Information", see crashtest.dev.

Design and development

See High Level Design and Low Level Design.

Check Design Patterns for design patterns used in the application, and the Testing Strategy.

Run & debug

Follow the steps to install aspire, using the latest .NET SDK version.

Then from the project root, run:

aspire run

You should then get a web address for the aspire web dashboard, navigate to there, you should then see a list of resources, and their URLs.

$ aspire run

     AppHost:  CrashTest.Dev.AppHost/CrashTest.Dev.AppHost.csproj                 
                                                                                  
   Dashboard:  https://localhost:17263/login?t=70e2e0727778403aaf8b910cef67e6da   
                                                                                  
        Logs:  ~/.aspire/logs/cli_20260415T074308_9ec3a937.log      
                                                            
               Press CTRL+C to stop the apphost and exit.   

Aspire Dashboard with a table of resources showing the URLs of each and their status

Some resources will appear unhealthy initially, the app resource is the main web application in the CrashTest.Dev project, it is the last to start up, and should be available at https://localhost:7044 when it does.

Using

This is more or less a simple CRUD app in function, see (high level design)[docs/HLD.md], some pages will require authentication and will redirect you to the Keycloak instance aspire spun up.

Authenticating

Keycloak is used for authenticating which is needed to make any DB changes, aspire spins up an instance of Keycloak on localhost:8080.

Accessing an auth only page will redirect you to Keycloak, aspire will have also have configured a default username and password which are:

Username: foster
Password: daphone

These do not need to be changed for local dev purposes, but will not work for live deployments.

Database Migrations

Ensure you have EF Tools installed with

dotnet tool install --global dotnet-ef

Due to a quirk of the MySQL EF Core Aspire integration and EF Tools, you will need to explicitly set the connection string of the MySQL database in the CrashTest.Dev project, to do this, start the project with aspire run as above.

Wait for the MySQL resource to start and become healthy, once it is, click on the row to reveal the details, then you can view the connection string.

Screen shot of the Aspire dashboard showing the details for the MySQL resource in a pop-up menu on the right hand side.

Screenshot of the Aspire dashboard showing the connection string for the MySQL resource in the modal.

You will need to edit the port, as for whatever reason aspire uses a temporary port, you can get the port by checking the container for the exposed port.

$ [podman or docker] ps -f name=crashtest-mysql
CONTAINER ID  IMAGE                        COMMAND     CREATED      STATUS      PORTS                                 NAMES
bd1866b0908d  docker.io/library/mysql:9.6  mysqld      5 hours ago  Up 5 hours  127.0.0.1:43247->3306/tcp, 33060/tcp  crashtest-mysql

43247 is the port number in this case

Then in a command line in the CrashTest.Dev project directory, run:

SlnRoot/CrashTest.Dev$ dotnet user-secrets init
SlnRoot/CrashTest.Dev$ dotnet user-secrets set "Aspire:Pomelo:EntityFrameworkCore:MySql:ConnectionString" "[your connection string]"

Then you can make you changes to the models and context in CrashTest.Dev.DB, and then from the CrashTest.Dev project directory run:

SlnRoot/CrashTest.Dev$ dotnet ef migrations add NameOfEdit --project ../CrashTest.Dev.DB/CrashTest.Dev.DB.csproj

Once you run the project again, Aspire will apply this migration to the database automatically.

Testing

See testing strategy for more information specific to tests

To run all the available tests, from the project root run:

dotnet test

Tasks

In progress

  • Build test & deploy to testing.crashtest.dev pipeline in Forgejo when merging into testing
  • Complete NewPost page and models

For MVP

  • Complete post view page
  • Complete post edit page
  • Create series create page
  • Create series edit page
  • Create series view page
  • Add categories to models
  • Create notes back end infrastructure and tests
  • Create note create page
  • Create note edit page
  • Create note view page
  • Create post search page
  • Create note search page
  • Build test & deploy to crashtest.dev pipeline in Forgejo when merging into main

Blocked

  • Coverage report including DB migrations and fluent validators

Nice to haves