@@ -24,6 +24,8 @@ public MethodTests()
24
24
[ Fact ]
25
25
public void should_return_response_200_when_get_converted_to_post ( )
26
26
{
27
+ var port = RandomPortFinder . GetRandomPort ( ) ;
28
+
27
29
var configuration = new FileConfiguration
28
30
{
29
31
ReRoutes = new List < FileReRoute >
@@ -39,15 +41,15 @@ public void should_return_response_200_when_get_converted_to_post()
39
41
new FileHostAndPort
40
42
{
41
43
Host = "localhost" ,
42
- Port = 53171 ,
44
+ Port = port ,
43
45
} ,
44
46
} ,
45
47
DownstreamHttpMethod = "POST" ,
46
48
} ,
47
49
} ,
48
50
} ;
49
51
50
- this . Given ( x => x . GivenThereIsAServiceRunningOn ( "http://localhost:53171 /" , "/" , "POST" ) )
52
+ this . Given ( x => x . GivenThereIsAServiceRunningOn ( $ "http://localhost:{ port } /", "/" , "POST" ) )
51
53
. And ( x => _steps . GivenThereIsAConfiguration ( configuration ) )
52
54
. And ( x => _steps . GivenOcelotIsRunning ( ) )
53
55
. When ( x => _steps . WhenIGetUrlOnTheApiGateway ( "/" ) )
@@ -58,6 +60,8 @@ public void should_return_response_200_when_get_converted_to_post()
58
60
[ Fact ]
59
61
public void should_return_response_200_when_get_converted_to_post_with_content ( )
60
62
{
63
+ var port = RandomPortFinder . GetRandomPort ( ) ;
64
+
61
65
var configuration = new FileConfiguration
62
66
{
63
67
ReRoutes = new List < FileReRoute >
@@ -73,7 +77,7 @@ public void should_return_response_200_when_get_converted_to_post_with_content()
73
77
new FileHostAndPort
74
78
{
75
79
Host = "localhost" ,
76
- Port = 53271 ,
80
+ Port = port ,
77
81
} ,
78
82
} ,
79
83
DownstreamHttpMethod = "POST" ,
@@ -84,7 +88,7 @@ public void should_return_response_200_when_get_converted_to_post_with_content()
84
88
const string expected = "here is some content" ;
85
89
var httpContent = new StringContent ( expected ) ;
86
90
87
- this . Given ( x => x . GivenThereIsAServiceRunningOn ( "http://localhost:53271 /" , "/" , "POST" ) )
91
+ this . Given ( x => x . GivenThereIsAServiceRunningOn ( $ "http://localhost:{ port } /", "/" , "POST" ) )
88
92
. And ( x => _steps . GivenThereIsAConfiguration ( configuration ) )
89
93
. And ( x => _steps . GivenOcelotIsRunning ( ) )
90
94
. When ( x => _steps . WhenIGetUrlOnTheApiGateway ( "/" , httpContent ) )
@@ -96,6 +100,8 @@ public void should_return_response_200_when_get_converted_to_post_with_content()
96
100
[ Fact ]
97
101
public void should_return_response_200_when_get_converted_to_get_with_content ( )
98
102
{
103
+ var port = RandomPortFinder . GetRandomPort ( ) ;
104
+
99
105
var configuration = new FileConfiguration
100
106
{
101
107
ReRoutes = new List < FileReRoute >
@@ -111,7 +117,7 @@ public void should_return_response_200_when_get_converted_to_get_with_content()
111
117
new FileHostAndPort
112
118
{
113
119
Host = "localhost" ,
114
- Port = 53272 ,
120
+ Port = port ,
115
121
} ,
116
122
} ,
117
123
DownstreamHttpMethod = "GET" ,
@@ -122,7 +128,7 @@ public void should_return_response_200_when_get_converted_to_get_with_content()
122
128
const string expected = "here is some content" ;
123
129
var httpContent = new StringContent ( expected ) ;
124
130
125
- this . Given ( x => x . GivenThereIsAServiceRunningOn ( "http://localhost:53272 /" , "/" , "GET" ) )
131
+ this . Given ( x => x . GivenThereIsAServiceRunningOn ( $ "http://localhost:{ port } /", "/" , "GET" ) )
126
132
. And ( x => _steps . GivenThereIsAConfiguration ( configuration ) )
127
133
. And ( x => _steps . GivenOcelotIsRunning ( ) )
128
134
. When ( x => _steps . WhenIPostUrlOnTheApiGateway ( "/" , httpContent ) )
0 commit comments