@@ -51,83 +51,89 @@ public class TestAmqpUri
51
51
[ Test , Category ( "MonoBug" ) ]
52
52
public void TestAmqpUriParseFail ( )
53
53
{
54
- /* Various failure cases */
55
- ParseFailWith < ArgumentException > ( "http://www.rabbitmq.com" ) ;
56
- ParseFailWith < UriFormatException > ( "amqp://foo:bar:baz" ) ;
57
- ParseFailWith < UriFormatException > ( "amqp://foo[::1]" ) ;
58
- ParseFailWith < UriFormatException > ( "amqp://foo:[::1]" ) ;
59
- ParseFailWith < UriFormatException > ( "amqp://foo:1000xyz" ) ;
60
- ParseFailWith < UriFormatException > ( "amqp://foo:1000000" ) ;
61
- ParseFailWith < ArgumentException > ( "amqp://foo/bar/baz" ) ;
54
+ if ( IsRunningOnMono ( ) == false )
55
+ {
56
+ /* Various failure cases */
57
+ ParseFailWith < ArgumentException > ( "http://www.rabbitmq.com" ) ;
58
+ ParseFailWith < UriFormatException > ( "amqp://foo:bar:baz" ) ;
59
+ ParseFailWith < UriFormatException > ( "amqp://foo[::1]" ) ;
60
+ ParseFailWith < UriFormatException > ( "amqp://foo:[::1]" ) ;
61
+ ParseFailWith < UriFormatException > ( "amqp://foo:1000xyz" ) ;
62
+ ParseFailWith < UriFormatException > ( "amqp://foo:1000000" ) ;
63
+ ParseFailWith < ArgumentException > ( "amqp://foo/bar/baz" ) ;
62
64
63
- ParseFailWith < UriFormatException > ( "amqp://foo%1" ) ;
64
- ParseFailWith < UriFormatException > ( "amqp://foo%1x" ) ;
65
- ParseFailWith < UriFormatException > ( "amqp://foo%xy" ) ;
65
+ ParseFailWith < UriFormatException > ( "amqp://foo%1" ) ;
66
+ ParseFailWith < UriFormatException > ( "amqp://foo%1x" ) ;
67
+ ParseFailWith < UriFormatException > ( "amqp://foo%xy" ) ;
68
+ }
66
69
}
67
70
68
71
[ Test , Category ( "MonoBug" ) ]
69
72
public void TestAmqpUriParseSucceed ( )
70
73
{
71
- /* From the spec */
72
- ParseSuccess ( "amqp://user:pass@host:10000/vhost" ,
73
- "user" , "pass" , "host" , 10000 , "vhost" ) ;
74
- ParseSuccess ( "aMQps://user%61:%61pass@host:10000/v%2fhost" ,
75
- "usera" , "apass" , "host" , 10000 , "v/host" ) ;
76
- ParseSuccess ( "amqp://localhost" , "guest" , "guest" , "localhost" , 5672 , "/" ) ;
77
- ParseSuccess ( "amqp://:@localhost/" , "" , "" , "localhost" , 5672 , "/" ) ;
78
- ParseSuccess ( "amqp://user@localhost" ,
79
- "user" , "guest" , "localhost" , 5672 , "/" ) ;
80
- ParseSuccess ( "amqp://user:pass@localhost" ,
81
- "user" , "pass" , "localhost" , 5672 , "/" ) ;
82
- ParseSuccess ( "amqp://host" , "guest" , "guest" , "host" , 5672 , "/" ) ;
83
- ParseSuccess ( "amqp://localhost:10000" ,
84
- "guest" , "guest" , "localhost" , 10000 , "/" ) ;
85
- ParseSuccess ( "amqp://localhost/vhost" ,
86
- "guest" , "guest" , "localhost" , 5672 , "vhost" ) ;
87
- ParseSuccess ( "amqp://host/" , "guest" , "guest" , "host" , 5672 , "/" ) ;
88
- ParseSuccess ( "amqp://host/%2f" ,
89
- "guest" , "guest" , "host" , 5672 , "/" ) ;
90
- ParseSuccess ( "amqp://[::1]" , "guest" , "guest" ,
91
- IPv6Loopbacks ,
92
- 5672 , "/" ) ;
74
+ if ( IsRunningOnMono ( ) == false )
75
+ {
76
+ /* From the spec */
77
+ ParseSuccess ( "amqp://user:pass@host:10000/vhost" ,
78
+ "user" , "pass" , "host" , 10000 , "vhost" ) ;
79
+ ParseSuccess ( "aMQps://user%61:%61pass@host:10000/v%2fhost" ,
80
+ "usera" , "apass" , "host" , 10000 , "v/host" ) ;
81
+ ParseSuccess ( "amqp://localhost" , "guest" , "guest" , "localhost" , 5672 , "/" ) ;
82
+ ParseSuccess ( "amqp://:@localhost/" , "" , "" , "localhost" , 5672 , "/" ) ;
83
+ ParseSuccess ( "amqp://user@localhost" ,
84
+ "user" , "guest" , "localhost" , 5672 , "/" ) ;
85
+ ParseSuccess ( "amqp://user:pass@localhost" ,
86
+ "user" , "pass" , "localhost" , 5672 , "/" ) ;
87
+ ParseSuccess ( "amqp://host" , "guest" , "guest" , "host" , 5672 , "/" ) ;
88
+ ParseSuccess ( "amqp://localhost:10000" ,
89
+ "guest" , "guest" , "localhost" , 10000 , "/" ) ;
90
+ ParseSuccess ( "amqp://localhost/vhost" ,
91
+ "guest" , "guest" , "localhost" , 5672 , "vhost" ) ;
92
+ ParseSuccess ( "amqp://host/" , "guest" , "guest" , "host" , 5672 , "/" ) ;
93
+ ParseSuccess ( "amqp://host/%2f" ,
94
+ "guest" , "guest" , "host" , 5672 , "/" ) ;
95
+ ParseSuccess ( "amqp://[::1]" , "guest" , "guest" ,
96
+ IPv6Loopbacks ,
97
+ 5672 , "/" ) ;
93
98
94
- /* Various other success cases */
95
- ParseSuccess ( "amqp://host:100" ,
96
- "guest" , "guest" , "host" , 100 , "/" ) ;
97
- ParseSuccess ( "amqp://[::1]:100" ,
98
- "guest" , "guest" ,
99
- IPv6Loopbacks ,
100
- 100 , "/" ) ;
99
+ /* Various other success cases */
100
+ ParseSuccess ( "amqp://host:100" ,
101
+ "guest" , "guest" , "host" , 100 , "/" ) ;
102
+ ParseSuccess ( "amqp://[::1]:100" ,
103
+ "guest" , "guest" ,
104
+ IPv6Loopbacks ,
105
+ 100 , "/" ) ;
101
106
102
- ParseSuccess ( "amqp://host/blah" ,
103
- "guest" , "guest" , "host" , 5672 , "blah" ) ;
104
- ParseSuccess ( "amqp://host:100/blah" ,
105
- "guest" , "guest" , "host" , 100 , "blah" ) ;
106
- ParseSuccess ( "amqp://localhost:100/blah" ,
107
- "guest" , "guest" , "localhost" , 100 , "blah" ) ;
108
- ParseSuccess ( "amqp://[::1]/blah" ,
109
- "guest" , "guest" ,
110
- IPv6Loopbacks ,
111
- 5672 , "blah" ) ;
112
- ParseSuccess ( "amqp://[::1]:100/blah" ,
113
- "guest" , "guest" ,
114
- IPv6Loopbacks ,
115
- 100 , "blah" ) ;
107
+ ParseSuccess ( "amqp://host/blah" ,
108
+ "guest" , "guest" , "host" , 5672 , "blah" ) ;
109
+ ParseSuccess ( "amqp://host:100/blah" ,
110
+ "guest" , "guest" , "host" , 100 , "blah" ) ;
111
+ ParseSuccess ( "amqp://localhost:100/blah" ,
112
+ "guest" , "guest" , "localhost" , 100 , "blah" ) ;
113
+ ParseSuccess ( "amqp://[::1]/blah" ,
114
+ "guest" , "guest" ,
115
+ IPv6Loopbacks ,
116
+ 5672 , "blah" ) ;
117
+ ParseSuccess ( "amqp://[::1]:100/blah" ,
118
+ "guest" , "guest" ,
119
+ IPv6Loopbacks ,
120
+ 100 , "blah" ) ;
116
121
117
- ParseSuccess ( "amqp://user:pass@host" ,
118
- "user" , "pass" , "host" , 5672 , "/" ) ;
119
- ParseSuccess ( "amqp://user:pass@host:100" ,
120
- "user" , "pass" , "host" , 100 , "/" ) ;
121
- ParseSuccess ( "amqp://user:pass@localhost:100" ,
122
- "user" , "pass" , "localhost" , 100 , "/" ) ;
123
- ParseSuccess ( "amqp://user:pass@[::1]" ,
124
- "user" , "pass" ,
125
- IPv6Loopbacks ,
126
- 5672 , "/" ) ;
127
- ParseSuccess ( "amqp://user:pass@[::1]:100" ,
128
- "user" , "pass" ,
129
- IPv6Loopbacks ,
130
- 100 , "/" ) ;
122
+ ParseSuccess ( "amqp://user:pass@host" ,
123
+ "user" , "pass" , "host" , 5672 , "/" ) ;
124
+ ParseSuccess ( "amqp://user:pass@host:100" ,
125
+ "user" , "pass" , "host" , 100 , "/" ) ;
126
+ ParseSuccess ( "amqp://user:pass@localhost:100" ,
127
+ "user" , "pass" , "localhost" , 100 , "/" ) ;
128
+ ParseSuccess ( "amqp://user:pass@[::1]" ,
129
+ "user" , "pass" ,
130
+ IPv6Loopbacks ,
131
+ 5672 , "/" ) ;
132
+ ParseSuccess ( "amqp://user:pass@[::1]:100" ,
133
+ "user" , "pass" ,
134
+ IPv6Loopbacks ,
135
+ 100 , "/" ) ;
136
+ }
131
137
}
132
138
133
139
private static void AssertUriPartEquivalence ( string user , string password , int port , string vhost , ConnectionFactory cf )
@@ -158,5 +164,13 @@ private void ParseSuccess(string uri, string user, string password,
158
164
AssertUriPartEquivalence ( user , password , port , vhost , factory ) ;
159
165
Assert . IsTrue ( ( Array . IndexOf ( hosts , factory . HostName ) ) != - 1 ) ;
160
166
}
167
+ public static bool IsRunningOnMono ( )
168
+ {
169
+ #if CORECLR
170
+ return false ;
171
+ #else
172
+ return Type . GetType ( "Mono.Runtime" ) != null ;
173
+ #endif
174
+ }
161
175
}
162
176
}
0 commit comments