|
| 1 | +# AGENTS.md - CSharpDriver |
| 2 | + |
| 3 | +## Overview |
| 4 | +The C# driver for MongoDB. |
| 5 | + |
| 6 | +## Tech Stack |
| 7 | +- .NET library projects producing NuGet packages |
| 8 | +- Multi-targeted to various .NET versions from .NET Framework 4.7.2 up |
| 9 | +- xUnit + FluentAssertions for testing |
| 10 | + |
| 11 | +## Project Structure |
| 12 | +- `src/MongoDB.Bson/` - BSON for MongoDB |
| 13 | +- `src/MongoDB.Driver/` - C# driver for MongoDB |
| 14 | +- `src/MongoDB.Driver.Encryption/` - Client encryption (CSFLE with KMS). |
| 15 | +- `src/MongoDB.Driver.Authentication.AWS/` - AWS IAM authentication |
| 16 | +- `tests/MongoDB.Driver.Tests/` - Main C# driver tests |
| 17 | +- `tests/MongoDB.Bson.Tests/` - BSON handling tests |
| 18 | +- `tests/*/TestHelpers` - Common test utilities |
| 19 | +- `tests/*` - Specialized tests; less common |
| 20 | +- `tests/MongoDB.Driver.Tests/Specifications/` are JSON-driven tests using a common runner. |
| 21 | + |
| 22 | +## Commands |
| 23 | +- Build: `dotnet build CSharpDriver.sln` |
| 24 | +- Run all tests: `dotnet test tests/MongoDB.Driver.Tests/MongoDB.Driver.Tests.csproj -f net10.0` |
| 25 | +- Run a single test class: `dotnet test tests/MongoDB.Driver.Tests/MongoDB.Driver.Tests.csproj -f net10.0 --filter "FullyQualifiedName~ClassName"` |
| 26 | + |
| 27 | +A MongoDB connection is always available locally, so "integration" tests can be run as well as unit tests. Some test suites also require additional environment variables — if you need to run those tests and the variables are not set, stop and tell the user which variables are needed rather than working around it. |
| 28 | + |
| 29 | +| Feature area | Required environment variables | |
| 30 | +|---|---| |
| 31 | +| Atlas Search | `ATLAS_SEARCH_TESTS_ENABLED`, `ATLAS_SEARCH_URI` | |
| 32 | +| Atlas Search index helpers | `ATLAS_SEARCH_INDEX_HELPERS_TESTS_ENABLED`, `ATLAS_SEARCH_URI` | |
| 33 | +| CSFLE / auto-encryption | `CRYPT_SHARED_LIB_PATH` | |
| 34 | +| CSFLE with KMS mock servers | `KMS_MOCK_SERVERS_ENABLED` | |
| 35 | +| CSFLE with AWS KMS | `CSFLE_AWS_TEMPORARY_CREDS_ENABLED` | |
| 36 | +| CSFLE with Azure KMS | `CSFLE_AZURE_KMS_TESTS_ENABLED` | |
| 37 | +| CSFLE with GCP KMS | `CSFLE_GCP_KMS_TESTS_ENABLED` | |
| 38 | +| AWS authentication | `AWS_TESTS_ENABLED` | |
| 39 | +| GSSAPI / Kerberos | `GSSAPI_TESTS_ENABLED`, `AUTH_HOST`, `AUTH_GSSAPI` | |
| 40 | +| OIDC authentication | `OIDC_ENV` | |
| 41 | +| X.509 authentication | `MONGO_X509_CLIENT_CERTIFICATE_PATH`, `MONGO_X509_CLIENT_CERTIFICATE_PASSWORD` | |
| 42 | +| PLAIN authentication | `PLAIN_AUTH_TESTS_ENABLED` | |
| 43 | +| SOCKS5 proxy | `SOCKS5_PROXY_SERVERS_ENABLED` | |
| 44 | + |
| 45 | +## Commit and PR Conventions |
| 46 | + |
| 47 | +- Commit and PR messages start with a JIRA number: `CSHARP-1234: Description` |
0 commit comments