File tree Expand file tree Collapse file tree 2 files changed +32
-11
lines changed Expand file tree Collapse file tree 2 files changed +32
-11
lines changed Original file line number Diff line number Diff line change @@ -11,18 +11,28 @@ namespace Ipfs.Api
1111 [ TestClass ]
1212 public class DhtApiTest
1313 {
14- const string marsId = "QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3" ;
15- const string marsPublicKey = "CAASogEwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKGUtbRQf+a9SBHFEruNAUatS/tsGUnHuCtifGrlbYPELD3UyyhWf/FYczBCavx3i8hIPEW2jQv4ehxQxi/cg9SHswZCQblSi0ucwTBFr8d40JEiyB9CcapiMdFQxdMgGvXEOQdLz1pz+UPUDojkdKZq8qkkeiBn7KlAoGEocnmpAgMBAAE=" ;
1614 const string helloWorldID = "QmT78zSuBmuS4z925WZfrqQ1qHaJ56DQaTfyMUF7F8ff5o" ;
1715
1816 [ TestMethod ]
1917 public async Task FindPeer ( )
2018 {
2119 var ipfs = TestFixture . Ipfs ;
22- var peer = await ipfs . Dht . FindPeerAsync ( marsId ) ;
20+ Peer node ;
21+ foreach ( var peer in await ipfs . Bootstrap . ListAsync ( ) )
22+ {
23+ try
24+ {
25+ node = await ipfs . Dht . FindPeerAsync ( peer . PeerId ) ;
26+ }
27+ catch ( Exception )
28+ {
29+ continue ;
30+ }
2331
24- // If DHT can't find a peer, it will return a 'closer' peer.
25- Assert . IsNotNull ( peer ) ;
32+ // If DHT can't find a peer, it will return a 'closer' peer.
33+ Assert . IsNotNull ( peer ) ;
34+ break ;
35+ }
2636 }
2737
2838 [ TestMethod ]
Original file line number Diff line number Diff line change 22using Newtonsoft . Json . Linq ;
33using System ;
44using System . Text ;
5-
5+ using System . Threading . Tasks ;
6+
67namespace Ipfs . Api
78{
89 [ TestClass ]
910 public class GenericApiTest
1011 {
11- const string marsId = "QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3" ;
12-
1312 [ TestMethod ]
1413 public void Local_Node_Info ( )
1514 {
@@ -19,11 +18,23 @@ public void Local_Node_Info()
1918 }
2019
2120 [ TestMethod ]
22- public void Mars_Node_Info ( )
21+ public async Task Peer_Node_Info ( )
2322 {
2423 var ipfs = TestFixture . Ipfs ;
25- var node = ipfs . IdAsync ( marsId ) . Result ;
26- Assert . IsInstanceOfType ( node , typeof ( Peer ) ) ;
24+ Peer node ;
25+ foreach ( var peer in await ipfs . Bootstrap . ListAsync ( ) )
26+ {
27+ try
28+ {
29+ node = await ipfs . IdAsync ( peer . PeerId ) ;
30+ }
31+ catch ( Exception )
32+ {
33+ continue ;
34+ }
35+ Assert . IsInstanceOfType ( node , typeof ( Peer ) ) ;
36+ break ;
37+ }
2738 }
2839
2940 [ TestMethod ]
You can’t perform that action at this time.
0 commit comments