@@ -30,13 +30,13 @@ TEST(hub_connection_tests, connection_status_start_stop_start)
30
30
31
31
TEST (hub_connection_tests, send_message)
32
32
{
33
- auto hub_conn = std::make_shared<signalr::hub_connection>(url + U ( " custom" ) , signalr::trace_level::all, nullptr );
33
+ auto hub_conn = std::make_shared<signalr::hub_connection>(url + " custom" , signalr::trace_level::all, nullptr );
34
34
auto message = std::make_shared<std::string>();
35
35
auto received_event = std::make_shared<signalr::event>();
36
36
37
- hub_conn->on (U ( " sendString" ) , [message, received_event](const web::json::value& arguments)
37
+ hub_conn->on (" sendString" , [message, received_event](const web::json::value& arguments)
38
38
{
39
- *message = arguments.serialize ();
39
+ *message = utility::conversions::to_utf8string ( arguments.serialize () );
40
40
received_event->set ();
41
41
});
42
42
@@ -45,13 +45,13 @@ TEST(hub_connection_tests, send_message)
45
45
web::json::value obj{};
46
46
obj[0 ] = web::json::value (U (" test" ));
47
47
48
- return hub_conn->send (U ( " invokeWithString" ) , obj);
48
+ return hub_conn->send (" invokeWithString" , obj);
49
49
50
50
}).get ();
51
51
52
52
ASSERT_FALSE (received_event->wait (2000 ));
53
53
54
- ASSERT_EQ (*message, U ( " [\" Send: test\" ]" ) );
54
+ ASSERT_EQ (*message, " [\" Send: test\" ]" );
55
55
}
56
56
57
57
TEST (hub_connection_tests, send_message_return)
@@ -63,7 +63,7 @@ TEST(hub_connection_tests, send_message_return)
63
63
web::json::value obj{};
64
64
obj[0 ] = web::json::value (U (" test" ));
65
65
66
- return hub_conn->invoke (U ( " returnString" ) , obj);
66
+ return hub_conn->invoke (" returnString" , obj);
67
67
68
68
}).get ();
69
69
@@ -76,9 +76,9 @@ TEST(hub_connection_tests, send_message_after_connection_restart)
76
76
auto message = std::make_shared<std::string>();
77
77
auto received_event = std::make_shared<signalr::event>();
78
78
79
- hub_conn->on (U ( " sendString" ) , [message, received_event](const web::json::value& arguments)
79
+ hub_conn->on (" sendString" , [message, received_event](const web::json::value& arguments)
80
80
{
81
- *message = arguments.serialize ();
81
+ *message = utility::conversions::to_utf8string ( arguments.serialize () );
82
82
received_event->set ();
83
83
});
84
84
@@ -91,13 +91,13 @@ TEST(hub_connection_tests, send_message_after_connection_restart)
91
91
web::json::value obj{};
92
92
obj[0 ] = web::json::value (U (" test" ));
93
93
94
- return hub_conn->send (U ( " invokeWithString" ) , obj);
94
+ return hub_conn->send (" invokeWithString" , obj);
95
95
96
96
}).get ();
97
97
98
98
ASSERT_FALSE (received_event->wait (2000 ));
99
99
100
- ASSERT_EQ (*message, U ( " [\" Send: test\" ]" ) );
100
+ ASSERT_EQ (*message, " [\" Send: test\" ]" );
101
101
}
102
102
103
103
TEST (hub_connection_tests, send_message_empty_param)
@@ -106,21 +106,21 @@ TEST(hub_connection_tests, send_message_empty_param)
106
106
auto message = std::make_shared<std::string>();
107
107
auto received_event = std::make_shared<signalr::event>();
108
108
109
- hub_conn->on (U ( " sendString" ) , [message, received_event](const web::json::value& arguments)
109
+ hub_conn->on (" sendString" , [message, received_event](const web::json::value& arguments)
110
110
{
111
- *message = arguments.serialize ();
111
+ *message = utility::conversions::to_utf8string ( arguments.serialize () );
112
112
received_event->set ();
113
113
});
114
114
115
115
hub_conn->start ().then ([&hub_conn]()
116
116
{
117
- return hub_conn->invoke (U ( " invokeWithEmptyParam" ) );
117
+ return hub_conn->invoke (" invokeWithEmptyParam" );
118
118
119
119
}).get ();
120
120
121
121
ASSERT_FALSE (received_event->wait (2000 ));
122
122
123
- ASSERT_EQ (*message, U ( " [\" Send\" ]" ) );
123
+ ASSERT_EQ (*message, " [\" Send\" ]" );
124
124
}
125
125
126
126
TEST (hub_connection_tests, send_message_primitive_params)
@@ -129,9 +129,9 @@ TEST(hub_connection_tests, send_message_primitive_params)
129
129
auto message = std::make_shared<std::string>();
130
130
auto received_event = std::make_shared<signalr::event>();
131
131
132
- hub_conn->on (U ( " sendPrimitiveParams" ) , [message, received_event](const web::json::value& arguments)
132
+ hub_conn->on (" sendPrimitiveParams" , [message, received_event](const web::json::value& arguments)
133
133
{
134
- *message = arguments.serialize ();
134
+ *message = utility::conversions::to_utf8string ( arguments.serialize () );
135
135
received_event->set ();
136
136
});
137
137
@@ -143,7 +143,7 @@ TEST(hub_connection_tests, send_message_primitive_params)
143
143
obj[2 ] = web::json::value (8.999999999 );
144
144
obj[3 ] = web::json::value (true );
145
145
obj[4 ] = web::json::value (' a' );
146
- return hub_conn->send (U ( " invokeWithPrimitiveParams" ) , obj);
146
+ return hub_conn->send (" invokeWithPrimitiveParams" , obj);
147
147
148
148
}).get ();
149
149
@@ -156,7 +156,7 @@ TEST(hub_connection_tests, send_message_primitive_params)
156
156
obj[3 ] = web::json::value (true );
157
157
obj[4 ] = web::json::value::string (U (" a" ));
158
158
159
- ASSERT_EQ (*message, obj.serialize ());
159
+ ASSERT_EQ (*message, utility::conversions::to_utf8string ( obj.serialize () ));
160
160
}
161
161
162
162
TEST (hub_connection_tests, send_message_complex_type)
@@ -165,9 +165,9 @@ TEST(hub_connection_tests, send_message_complex_type)
165
165
auto message = std::make_shared<std::string>();
166
166
auto received_event = std::make_shared<signalr::event>();
167
167
168
- hub_conn->on (U ( " sendComplexType" ) , [message, received_event](const web::json::value& arguments)
168
+ hub_conn->on (" sendComplexType" , [message, received_event](const web::json::value& arguments)
169
169
{
170
- *message = arguments.serialize ();
170
+ *message = utility::conversions::to_utf8string ( arguments.serialize () );
171
171
received_event->set ();
172
172
});
173
173
@@ -183,13 +183,13 @@ TEST(hub_connection_tests, send_message_complex_type)
183
183
person[U (" age" )] = web::json::value::number (15 );
184
184
obj[0 ] = person;
185
185
186
- return hub_conn->send (U ( " invokeWithComplexType" ) , obj);
186
+ return hub_conn->send (" invokeWithComplexType" , obj);
187
187
188
188
}).get ();
189
189
190
190
ASSERT_FALSE (received_event->wait (2000 ));
191
191
192
- ASSERT_EQ (*message, U ( " [{\" Address\" :{\" Street\" :\" main st\" ,\" Zip\" :\" 98052\" },\" Age\" :15,\" Name\" :\" test\" }]" ) );
192
+ ASSERT_EQ (*message, " [{\" Address\" :{\" Street\" :\" main st\" ,\" Zip\" :\" 98052\" },\" Age\" :15,\" Name\" :\" test\" }]" );
193
193
}
194
194
195
195
TEST (hub_connection_tests, send_message_complex_type_return)
@@ -208,7 +208,7 @@ TEST(hub_connection_tests, send_message_complex_type_return)
208
208
person[U (" age" )] = web::json::value::number (15 );
209
209
obj[0 ] = person;
210
210
211
- return hub_conn->invoke (U ( " returnComplexType" ) , obj);
211
+ return hub_conn->invoke (" returnComplexType" , obj);
212
212
213
213
}).get ();
214
214
@@ -222,17 +222,17 @@ TEST(hub_connection_tests, connection_id_start_stop_start)
222
222
223
223
std::string connection_id;
224
224
225
- ASSERT_EQ (U ( " " ) , hub_conn->get_connection_id ());
225
+ ASSERT_EQ (u8" " , hub_conn->get_connection_id ());
226
226
227
227
hub_conn->start ().get ();
228
228
connection_id = hub_conn->get_connection_id ();
229
- ASSERT_NE (connection_id, U ( " " ) );
229
+ ASSERT_NE (connection_id, u8" " );
230
230
231
231
hub_conn->stop ().get ();
232
232
ASSERT_EQ (hub_conn->get_connection_id (), connection_id);
233
233
234
234
hub_conn->start ().get ();
235
- ASSERT_NE (hub_conn->get_connection_id (), U ( " " ) );
235
+ ASSERT_NE (hub_conn->get_connection_id (), u8" " );
236
236
ASSERT_NE (hub_conn->get_connection_id (), connection_id);
237
237
238
238
connection_id = hub_conn->get_connection_id ();
0 commit comments