1- ## Overview
1+ # Overview
22
3- .NET client's test suite assumes there's a RabbitMQ node listening on ` localhost:5672 `
4- (the default settings). TLS tests require a node listening on the default
5- [ TLS port] ( https://rabbitmq.com/ssl.html ) .
3+ The RabbitMQ .NET client's test suite assumes there's a RabbitMQ node listening
4+ on ` localhost:5672 ` (the default settings). TLS tests require a node listening
5+ on the default [ TLS port] ( https://rabbitmq.com/ssl.html ) .
66
7- It is possible to use Visual Studio Community Edition .NET Core, and
8- ` dotnet.exe ` in ` PATH ` , to build the client and run the test suite.
7+ It is possible to use Visual Studio Community Edition and ` dotnet.exe ` in
8+ ` PATH ` , to build the client and run the test suite.
99
1010
1111## Building
1212
13- Before this project can be opened in Visual Studio, it's necessary to pull down dependencies
14- and perform protocol encoder/decoder code generation.
1513
16- On Windows run:
14+ ### Windows
1715
18- ``` powershell
19- build.bat
16+ ``` powershell
17+ build.ps1
2018```
2119
22- On MacOS and linux run:
20+ ### MacOS and Linux
2321
24- ``` shell
25- ./build.sh
22+ ``` shell
23+ dotnet build ./Build.csproj
2624```
2725
28- This will complete the code AMQP 0-9-1 protocol code generation and build all projects. After this open the solution in Visual Studio.
26+ This will build all projects. After this open the solution in Visual Studio.
2927
3028
3129## Test Environment Requirements
3230
33- Tests can be run from Visual Studio using the NUnit Test Adapter. Note that it
31+ Tests can be run from Visual Studio using the XUnit Test Adapter. Note that it
3432may take some time for the adapter to discover tests in the assemblies.
3533
3634The test suite assumes there's a RabbitMQ node running locally with all
3735defaults, and the tests will need to be able to run commands against the
3836[ ` rabbitmqctl ` ] ( https://www.rabbitmq.com/rabbitmqctl.8.html ) tool for that node.
3937Two options to accomplish this are covered below.
4038
39+
4140### Option One: Using a RabbitMQ Release
4241
4342It is possible to install and run a node using any [ binary build] ( https://www.rabbitmq.com/download.html )
@@ -46,16 +45,16 @@ invoked directly without using an absolute file path. Note that this method does
4645
4746On Windows, you must run unit tests as follows (replace ` X.Y.Z ` with your RabbitMQ version):
4847
49- ```
50- set " RABBITMQ_RABBITMQCTL_PATH=C:\Program Files\RabbitMQ Server\rabbitmq_server-X.Y.Z\sbin\rabbitmqctl.bat"
51- .\run-test.bat
48+ ``` powershell
49+ $env: RABBITMQ_RABBITMQCTL_PATH=' C:\Program Files\RabbitMQ Server\rabbitmq_server-X.Y.Z\sbin\rabbitmqctl.bat'
50+ .\build.ps1 -RunTests
5251```
5352
5453### Option Two: Building a RabbitMQ Node from Source
5554
5655T run a RabbitMQ node [ built from source] ( https://www.rabbitmq.com/build-server.html ) :
5756
58- ```
57+ ``` shell
5958git clone https://github.com/rabbitmq/rabbitmq-server.git rabbitmq-server
6059cd rabbitmq-server
6160
@@ -77,26 +76,32 @@ RABBITMQ_RABBITMQCTL_PATH=/path/to/rabbitmqctl dotnet test projects/Unit
7776
7877### Option Three: Using a Docker Container
7978
80- It is also possible to run a RabbitMQ node in a [ Docker] ( https://www.docker.com/ ) container. Set the environment variable ` RABBITMQ_RABBITMQCTL_PATH ` to ` DOCKER:<container_name> ` (for example ` DOCKER:rabbitmq01 ` ). This tells the unit tests to run the ` rabbitmqctl ` commands through Docker, in the format ` docker exec rabbitmq01 rabbitmqctl <args> ` :
79+ It is also possible to run a RabbitMQ node in a
80+ [ Docker] ( https://www.docker.com/ ) container. Set the environment variable
81+ ` RABBITMQ_RABBITMQCTL_PATH ` to ` DOCKER:<container_name> ` (for example
82+ ` DOCKER:rabbitmq01 ` ). This tells the unit tests to run the ` rabbitmqctl `
83+ commands through Docker, in the format `docker exec rabbitmq01 rabbitmqctl
84+ <args >`:
8185
82- ``` shell
86+ ``` shell
8387docker run -d --hostname rabbitmq01 --name rabbitmq01 -p 15672:15672 -p 5672:5672 rabbitmq:3-management
8488```
8589
8690## Running All Tests
8791
8892Then, to run the tests use:
8993
90- ``` powershell
91- # will run tests on .NET Core and .NET Framework
92- run-test.bat
94+
95+ ### Windows
96+
97+ ``` powershell
98+ build.ps1 -RunTests
9399```
94100
95- On MacOS, Linux, BSD use :
101+ ### MacOS, Linux, BSD:
96102
97- ``` shell
98- # will only run tests on .NET Core
99- run-test.sh
103+ ``` shell
104+ dotnet test ./Build.csproj
100105```
101106
102107## Running Individual Suites or Test Cases
@@ -115,5 +120,5 @@ dotnet test projects/Unit --filter "FullyQualifiedName~RabbitMQ.Client.Unit.Test
115120To run tests targeting .NET 6.0:
116121
117122``` shell
118- dotnet test -f " . net6.0" projects/Unit
123+ dotnet test --framework net6.0 projects/Unit
119124```
0 commit comments