@@ -107,6 +107,187 @@ public void bitcoin_address_generator_disregards_current_culture()
107
107
#endif
108
108
}
109
109
110
+ [ Fact ]
111
+ [ Category ( "PayloadGenerator/BitcoinCashAddress" ) ]
112
+ public void bitcoincash_address_generator_can_generate_address ( )
113
+ {
114
+ var address = "qqtlfk37qyey50f4wfuhc7jw85zsdp8s2swffjk890" ;
115
+ var amount = .123 ;
116
+ var label = "Some Label to Encode" ;
117
+ var message = "Some Message to Encode" ;
118
+
119
+ var generator = new PayloadGenerator . BitcoinCashAddress ( address , amount , label , message ) ;
120
+
121
+ generator
122
+ . ToString ( )
123
+ . ShouldBe ( "bitcoincash:qqtlfk37qyey50f4wfuhc7jw85zsdp8s2swffjk890?label=Some%20Label%20to%20Encode&message=Some%20Message%20to%20Encode&amount=.123" ) ;
124
+ }
125
+
126
+ [ Fact ]
127
+ [ Category ( "PayloadGenerator/BitcoinCashAddress" ) ]
128
+ public void bitcoincash_address_generator_should_skip_missing_label ( )
129
+ {
130
+ var address = "qqtlfk37qyey50f4wfuhc7jw85zsdp8s2swffjk890" ;
131
+ var amount = .123 ;
132
+ var message = "Some Message to Encode" ;
133
+
134
+
135
+ var generator = new PayloadGenerator . BitcoinCashAddress ( address , amount , null , message ) ;
136
+
137
+ generator
138
+ . ToString ( )
139
+ . ShouldNotContain ( "label" ) ;
140
+ }
141
+
142
+ [ Fact ]
143
+ [ Category ( "PayloadGenerator/BitcoinCashAddress" ) ]
144
+ public void bitcoincash_address_generator_should_skip_missing_message ( )
145
+ {
146
+ var address = "qqtlfk37qyey50f4wfuhc7jw85zsdp8s2swffjk890" ;
147
+ var amount = .123 ;
148
+
149
+
150
+ var generator = new PayloadGenerator . BitcoinCashAddress ( address , amount ) ;
151
+
152
+ generator
153
+ . ToString ( )
154
+ . ShouldNotContain ( "message" ) ;
155
+ }
156
+
157
+ [ Fact ]
158
+ [ Category ( "PayloadGenerator/BitcoinCashAddress" ) ]
159
+ public void bitcoincash_address_generator_should_round_to_satoshi ( )
160
+ {
161
+ var address = "qqtlfk37qyey50f4wfuhc7jw85zsdp8s2swffjk890" ;
162
+ var amount = .123456789 ;
163
+
164
+
165
+ var generator = new PayloadGenerator . BitcoinCashAddress ( address , amount ) ;
166
+
167
+ generator
168
+ . ToString ( )
169
+ . ShouldContain ( "amount=.12345679" ) ;
170
+ }
171
+
172
+ [ Fact ]
173
+ [ Category ( "PayloadGenerator/BitcoinCashAddress" ) ]
174
+ public void bitcoincash_address_generator_disregards_current_culture ( )
175
+ {
176
+ #if NETCOREAPP1_1
177
+ var currentCulture = CultureInfo . DefaultThreadCurrentCulture ;
178
+ CultureInfo . DefaultThreadCurrentCulture = new CultureInfo ( "de-DE" ) ;
179
+ #else
180
+ var currentCulture = Thread . CurrentThread . CurrentCulture ;
181
+ Thread . CurrentThread . CurrentCulture = new CultureInfo ( "de-DE" ) ;
182
+ #endif
183
+
184
+ var address = "qqtlfk37qyey50f4wfuhc7jw85zsdp8s2swffjk890" ;
185
+ var amount = .123 ;
186
+
187
+
188
+ var generator = new PayloadGenerator . BitcoinCashAddress ( address , amount ) ;
189
+
190
+ generator
191
+ . ToString ( )
192
+ . ShouldBe ( "bitcoincash:qqtlfk37qyey50f4wfuhc7jw85zsdp8s2swffjk890?amount=.123" ) ;
193
+
194
+ #if NETCOREAPP1_1
195
+ CultureInfo . DefaultThreadCurrentCulture = currentCulture ;
196
+ #else
197
+ Thread . CurrentThread . CurrentCulture = currentCulture ;
198
+ #endif
199
+ }
200
+
201
+ [ Fact ]
202
+ [ Category ( "PayloadGenerator/LitecoinAddress" ) ]
203
+ public void litecoin_address_generator_can_generate_address ( )
204
+ {
205
+ var address = "LY1t7iLnwtPCb1DPZP38FA835XzFqXBq54" ;
206
+ var amount = .123 ;
207
+ var label = "Some Label to Encode" ;
208
+ var message = "Some Message to Encode" ;
209
+
210
+ var generator = new PayloadGenerator . LitecoinAddress ( address , amount , label , message ) ;
211
+
212
+ generator
213
+ . ToString ( )
214
+ . ShouldBe ( "litecoin:LY1t7iLnwtPCb1DPZP38FA835XzFqXBq54?label=Some%20Label%20to%20Encode&message=Some%20Message%20to%20Encode&amount=.123" ) ;
215
+ }
216
+
217
+ [ Fact ]
218
+ [ Category ( "PayloadGenerator/LitecoinAddress" ) ]
219
+ public void litecoin_address_generator_should_skip_missing_label ( )
220
+ {
221
+ var address = "LY1t7iLnwtPCb1DPZP38FA835XzFqXBq54" ;
222
+ var amount = .123 ;
223
+ var message = "Some Message to Encode" ;
224
+
225
+
226
+ var generator = new PayloadGenerator . LitecoinAddress ( address , amount , null , message ) ;
227
+
228
+ generator
229
+ . ToString ( )
230
+ . ShouldNotContain ( "label" ) ;
231
+ }
232
+
233
+ [ Fact ]
234
+ [ Category ( "PayloadGenerator/LitecoinAddress" ) ]
235
+ public void litecoin_address_generator_should_skip_missing_message ( )
236
+ {
237
+ var address = "LY1t7iLnwtPCb1DPZP38FA835XzFqXBq54" ;
238
+ var amount = .123 ;
239
+
240
+
241
+ var generator = new PayloadGenerator . LitecoinAddress ( address , amount ) ;
242
+
243
+ generator
244
+ . ToString ( )
245
+ . ShouldNotContain ( "message" ) ;
246
+ }
247
+
248
+ [ Fact ]
249
+ [ Category ( "PayloadGenerator/LitecoinAddress" ) ]
250
+ public void litecoin_address_generator_should_round_to_satoshi ( )
251
+ {
252
+ var address = "LY1t7iLnwtPCb1DPZP38FA835XzFqXBq54" ;
253
+ var amount = .123456789 ;
254
+
255
+
256
+ var generator = new PayloadGenerator . LitecoinAddress ( address , amount ) ;
257
+
258
+ generator
259
+ . ToString ( )
260
+ . ShouldContain ( "amount=.12345679" ) ;
261
+ }
262
+
263
+ [ Fact ]
264
+ [ Category ( "PayloadGenerator/LitecoinAddress" ) ]
265
+ public void litecoin_address_generator_disregards_current_culture ( )
266
+ {
267
+ #if NETCOREAPP1_1
268
+ var currentCulture = CultureInfo . DefaultThreadCurrentCulture ;
269
+ CultureInfo . DefaultThreadCurrentCulture = new CultureInfo ( "de-DE" ) ;
270
+ #else
271
+ var currentCulture = Thread . CurrentThread . CurrentCulture ;
272
+ Thread . CurrentThread . CurrentCulture = new CultureInfo ( "de-DE" ) ;
273
+ #endif
274
+
275
+ var address = "LY1t7iLnwtPCb1DPZP38FA835XzFqXBq54" ;
276
+ var amount = .123 ;
277
+
278
+
279
+ var generator = new PayloadGenerator . LitecoinAddress ( address , amount ) ;
280
+
281
+ generator
282
+ . ToString ( )
283
+ . ShouldBe ( "litecoin:LY1t7iLnwtPCb1DPZP38FA835XzFqXBq54?amount=.123" ) ;
284
+
285
+ #if NETCOREAPP1_1
286
+ CultureInfo . DefaultThreadCurrentCulture = currentCulture ;
287
+ #else
288
+ Thread . CurrentThread . CurrentCulture = currentCulture ;
289
+ #endif
290
+ }
110
291
111
292
[ Fact ]
112
293
[ Category ( "PayloadGenerator/WiFi" ) ]
0 commit comments