- Always create pull requests against
petabridge/memorizer, not any fork - Use
gh pr create --repo petabridge/memorizerwhen creating PRs
This project uses Central Package Management (CPM) via Directory.Packages.props.
- Never use
VersionOverrideattributes in.csprojfiles - All package versions must be defined in
Directory.Packages.props - When adding new packages, add the
<PackageVersion>entry toDirectory.Packages.propsfirst - Project files should only contain
<PackageReference Include="PackageName" />without version attributes
This project supports both light and dark themes. When making CSS or stylesheet changes:
- Always provide both light and dark mode styles for any custom CSS
- The theme is controlled via
data-themeattribute on<html>element (data-theme="dark"ordata-theme="light") - Use
[data-theme="dark"]CSS selector to target dark mode styles - Theme switching is handled by
wwwroot/js/theme-switcher.js - Ensure sufficient color contrast in both modes for accessibility
- Example pattern:
/* Light mode (default) */ .my-class { background-color: #d4edda; color: #155724; } /* Dark mode */ [data-theme="dark"] .my-class { background-color: #1e4620; color: #75d47b; }
Integration tests use shared PostgreSQL containers via XUnit test collections. Each test class creates its own ServiceProvider with a connection pool. To prevent connection exhaustion:
- Test classes that create
ServiceProvidermust implementIDisposableand dispose it - If
ServiceProvideris created in the constructor, add aDispose()method - If
ServiceProvideris created per-test, useusing var services = CreateServices();
Example patterns:
// Pattern 1: ServiceProvider created in constructor
[Collection(nameof(IntegrationTestCollection))]
public class MyTests : IDisposable
{
private readonly IServiceProvider _services;
public MyTests(IntegrationTestFixture fixture)
{
_services = CreateServices(fixture);
}
public void Dispose()
{
(_services as IDisposable)?.Dispose();
}
}
// Pattern 2: ServiceProvider created per-test (for different configurations)
[Collection(nameof(IntegrationTestCollection))]
public class MyTests
{
private ServiceProvider CreateServices(string model) { /* ... */ }
[Fact]
public async Task MyTest()
{
using var services = CreateServices("model-a");
// test code...
}
}