1
- ## Overview
1
+ # Overview
2
2
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 ) .
6
6
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.
9
9
10
10
11
11
## Building
12
12
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.
15
13
16
- On Windows run:
14
+ ### Windows
17
15
18
- ``` powershell
19
- build.bat
16
+ ``` powershell
17
+ build.ps1
20
18
```
21
19
22
- On MacOS and linux run:
20
+ ### MacOS and Linux
23
21
24
- ``` shell
25
- ./build.sh
22
+ ``` shell
23
+ dotnet build ./Build.csproj
26
24
```
27
25
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.
29
27
30
28
31
29
## Test Environment Requirements
32
30
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
34
32
may take some time for the adapter to discover tests in the assemblies.
35
33
36
34
The test suite assumes there's a RabbitMQ node running locally with all
37
35
defaults, and the tests will need to be able to run commands against the
38
36
[ ` rabbitmqctl ` ] ( https://www.rabbitmq.com/rabbitmqctl.8.html ) tool for that node.
39
37
Two options to accomplish this are covered below.
40
38
39
+
41
40
### Option One: Using a RabbitMQ Release
42
41
43
42
It 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
46
45
47
46
On Windows, you must run unit tests as follows (replace ` X.Y.Z ` with your RabbitMQ version):
48
47
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
52
51
```
53
52
54
53
### Option Two: Building a RabbitMQ Node from Source
55
54
56
55
T run a RabbitMQ node [ built from source] ( https://www.rabbitmq.com/build-server.html ) :
57
56
58
- ```
57
+ ``` shell
59
58
git clone https://github.com/rabbitmq/rabbitmq-server.git rabbitmq-server
60
59
cd rabbitmq-server
61
60
@@ -77,26 +76,32 @@ RABBITMQ_RABBITMQCTL_PATH=/path/to/rabbitmqctl dotnet test projects/Unit
77
76
78
77
### Option Three: Using a Docker Container
79
78
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 >`:
81
85
82
- ``` shell
86
+ ``` shell
83
87
docker run -d --hostname rabbitmq01 --name rabbitmq01 -p 15672:15672 -p 5672:5672 rabbitmq:3-management
84
88
```
85
89
86
90
## Running All Tests
87
91
88
92
Then, to run the tests use:
89
93
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
93
99
```
94
100
95
- On MacOS, Linux, BSD use :
101
+ ### MacOS, Linux, BSD:
96
102
97
- ``` shell
98
- # will only run tests on .NET Core
99
- run-test.sh
103
+ ``` shell
104
+ dotnet test ./Build.csproj
100
105
```
101
106
102
107
## Running Individual Suites or Test Cases
@@ -115,5 +120,5 @@ dotnet test projects/Unit --filter "FullyQualifiedName~RabbitMQ.Client.Unit.Test
115
120
To run tests targeting .NET 6.0:
116
121
117
122
``` shell
118
- dotnet test -f " . net6.0" projects/Unit
123
+ dotnet test --framework net6.0 projects/Unit
119
124
```
0 commit comments