|
| 1 | +# :recycle: Contributing |
| 2 | + |
| 3 | +We welcome code changes that improve this library or fix a problem, please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on Github. We are very happy to merge your code in the official repository. Make sure to sign our [Contributor License Agreement (CLA)](https://docs.google.com/forms/d/e/1FAIpQLScFKsKkAJI7mhCr7K9rEIOpqIDThrWxuvxnwUq2XkHyG154vQ/viewform) first. See our license file for more details. |
| 4 | + |
| 5 | +## Getting started |
| 6 | + |
| 7 | +### Restore dependencies and build |
| 8 | + |
| 9 | +Most IDEs automatically prompt you to restore the dependencies but if not, use this command: |
| 10 | + |
| 11 | +```shell |
| 12 | +$ dotnet restore ./src |
| 13 | +``` |
| 14 | + |
| 15 | +Building: |
| 16 | + |
| 17 | +```shell |
| 18 | +$ dotnet build ./src |
| 19 | +``` |
| 20 | + |
| 21 | +### Run tests |
| 22 | + |
| 23 | +The tests we have are full fledged integration tests, meaning they will actually reach out to a Stream app. Hence the tests require at least two environment variables: `STREAM_API_KEY` and `STREAM_API_SECRET`. |
| 24 | + |
| 25 | +To have these env vars available for the test running, you need to set up a `.runsettings` file in the root of the project (don't worry, it's gitignored). |
| 26 | + |
| 27 | +> :bulb: Microsoft has a super detailed [documentation](https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file) about .runsettings file. |
| 28 | + |
| 29 | +It needs to look like this: |
| 30 | + |
| 31 | +```xml |
| 32 | +<?xml version="1.0" encoding="utf-8"?> |
| 33 | +<RunSettings> |
| 34 | + <RunConfiguration> |
| 35 | + <EnvironmentVariables> |
| 36 | + <STREAM_API_KEY>api_key_here</STREAM_API_KEY> |
| 37 | + <STREAM_API_SECRET>secret_key_here</STREAM_API_SECRET> |
| 38 | + </EnvironmentVariables> |
| 39 | + </RunConfiguration> |
| 40 | +</RunSettings> |
| 41 | +``` |
| 42 | + |
| 43 | +In CLI: |
| 44 | +```shell |
| 45 | +$ dotnet test -s .runsettings ./src/stream-net-tests |
| 46 | +``` |
| 47 | + |
| 48 | +Go to the next section to see how to use it in IDEs. |
| 49 | + |
| 50 | +## Recommended tools for day-to-day development |
| 51 | + |
| 52 | +### VS Code |
| 53 | + |
| 54 | +For VS Code, the recommended extensions are: |
| 55 | +- [C#](https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp) by Microsoft |
| 56 | +- [.NET Core Test Explorer](https://marketplace.visualstudio.com/items?itemName=formulahendry.dotnet-test-explorer) by Jun Huan |
| 57 | + |
| 58 | +Recommended settings (`.vscode/settings.json`): |
| 59 | +```json |
| 60 | +{ |
| 61 | + "omnisharp.testRunSettings": ".runsettings", |
| 62 | + "dotnet-test-explorer.testProjectPath": "./src/stream-net-tests", |
| 63 | +} |
| 64 | +``` |
| 65 | + |
| 66 | +### Visual Studio |
| 67 | + |
| 68 | +Follow [Microsoft's documentation](https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?view=vs-2022#specify-a-run-settings-file-in-the-ide) on how to set up `.runsettings` file. |
| 69 | + |
| 70 | +### Rider |
| 71 | + |
| 72 | +Follow [Jetbrain's documentation](https://www.jetbrains.com/help/rider/Reference__Options__Tools__Unit_Testing__MSTest.html) on how to set up `.runsettings` file. |
0 commit comments