Skip to content

Contributing

IchiSamaFR edited this page May 13, 2026 · 1 revision

Contributing

Thank you for your interest in contributing to MermaidSharp!

Coding Standards

General Principles

  • Target Framework: Core libraries and tests target .NET Framework 4.8 and .NET 8.0 (sample apps target .NET 9).
  • Language: C# for all code.
  • Readability: Write clear, self-explanatory code with meaningful names.
  • SOLID Principles: Adhere to SOLID design principles.
  • One class per file: Organize files into appropriate folders by feature or layer.
  • XML Documentation: All public types and members must include XML documentation comments.

Naming Conventions

Element Convention Example
Classes & Interfaces PascalCase UserService, IUserRepository
Methods & Properties PascalCase GetUserById
Private & public variables camelCase _userId, userId
Parameters camelCase userId
Constants PascalCase DefaultTimeout
Unit test methods Descriptive scenario GetUserById_ReturnsUser_WhenUserExists

Code Style

  • Braces: Allman style (braces on new lines).
  • Indentation: One tab per indentation level.
  • Line Length: Limit lines to 120 characters.
  • Usings: Place using statements outside the namespace. Remove unused usings.

Unit Test Standards

  • Framework: MSTest
  • Naming: MethodName_ExpectedBehavior_StateUnderTest
  • Structure: Arrange-Act-Assert (AAA) pattern
  • Isolation: Each test must be independent
  • Mocking: Use mocks or fakes for external dependencies

Running Tests

dotnet test src/MermaidSharp.sln -c Release

Submitting Changes

  1. Fork the repository.
  2. Create a feature branch from main.
  3. Implement your changes following the coding standards above.
  4. Ensure all existing tests pass and add new tests for your changes.
  5. Open a pull request with a clear description of the changes.

For more details, see .github/copilot-instructions.md.

Clone this wiki locally